require 'colorize'
require 'artii'
require 'tty-prompt'
# require_relative 'Highscores'
require_relative 'typing'
class Menu
    # attr_accessor start_questions:

def intro
    a = Artii::Base.new
    system('clear')
    puts "------------------------------   WELCOME TO   -------------------------------\n
    \n"
    puts a.asciify("\n\n\nKEYLORD\n\n\n").colorize(:black).on_white
    prompt1 = TTY::Prompt.new
    prompt1.keypress("------------------------ PRESS ANY KEY TO CONTINUE --------------------------\n
                            Game begins automatically in :countdown ...", timeout: 5)
end #def intro end

def main_menu
    system ('clear')
        prompt2 = TTY::Prompt.new(active_color: :cyan)
        @prompt2menu = [
                    {"Begin Test" => -> do print @start_questions end},
                   #{'Show High Scores' => -> do high_scores end },
                    {"Help" => -> do help_menu end},
                    {"Exit" => -> do puts "exit" end}
                     ]
        prompt2.select('Use ↑/↓ arrow keys, press Enter to select', @prompt2menu, help: " ", )
end #def main_menu end#

def help_menu
    a = Artii::Base.new
    system ('clear')
        puts a.asciify("HELP").colorize(:black).on_white
        print "The "
        print "KEYLORD".colorize(:light_blue).on_red
        puts " typing test requires you to:\n\n"
        puts "    A) Type the string that you see (using the keyboard); and".colorize(:yellow)
        puts "    B) press the ENTER key to submit\n\n".colorize(:yellow)
        print "Your "
        print 'speed and accuracy'.colorize(:red)
        puts " (Capitals AND Punctuation inclusive) will be judged"
        puts " If you are deemed worthy, You can submit your score into the 'Hall of Fame' & compete for the TOP Position\n"
        
        prompt1 = TTY::Prompt.new
        prompt1.keypress("------------------------ PRESS ANY KEY TO CONTINUE --------------------------\n")
        puts @main_menu
end # def help_menu end

# def exit_message
#     system ('clear')
#     puts "thank you for #{playing.colorize(:red)}"
#     prompt4 = TTY::Prompt.new
#     prompt4.keypress("------------------------ PRESS ANY KEY TO END THE GAME --------------------------\n
#                             Game will end automatically in :countdown ...", timeout: 5)
# end #def exit_message end#

end #class Menu end#
menucall = Menu.new
@newgame = menucall.intro
@main_menu = menucall.main_menu
