diff options
Diffstat (limited to 'src/setup/menus.py')
-rw-r--r-- | src/setup/menus.py | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/src/setup/menus.py b/src/setup/menus.py index 2ac048d..471b545 100644 --- a/src/setup/menus.py +++ b/src/setup/menus.py @@ -5,6 +5,7 @@ import curses import config from utils import strs +from game import start # setup logging import logging @@ -37,7 +38,7 @@ class MenuData(object): # TODO: improve the menu system so it doesn't use recursion def mainMenu(data): - ''' ''' + '''Displays the 'Main Menu' and handles its input''' # we use the current profile, so make sure there is one if (data.profile == None) | (data.profile == ''): @@ -91,7 +92,7 @@ def mainMenu(data): mainMenu(data) def changePlayerMenu(data): - ''' ''' + '''Displays the 'Change Player Profile' menu and handles its input''' # create a list of players profiles = config.getProfiles() @@ -131,7 +132,7 @@ def changePlayerMenu(data): mainMenu(data) def playGameMenu(data): - ''' ''' + '''Displays the 'Play Game' menu and handles its input''' # create a list of levels if (data.levels == None) | (data.levels == []): @@ -177,7 +178,7 @@ def playGameMenu(data): levelOptionsMenu(data) def levelOptionsMenu(data): - ''' ''' + '''Displays the level options menu and handles its input''' # make sure there is a level if (data.level == None) | (data.level == ''): @@ -194,9 +195,9 @@ def levelOptionsMenu(data): # get the max score, max duration, and last time played profile = config.getProfile(data.profile) - stats.append('Max Score - ' + str(profile.getMaxScore(data.level))) + stats.append('Max Score - ' + str(profile.getMaxScore(data.level))) stats.append('Max Duration - ' + str(profile.getMaxDuration(data.level))) - stats.append('Last Played - ' + profile.getLastTimePlayed(data.level)) + stats.append('Last Played - ' + str(profile.getLastTimePlayed(data.level))) stats.append('') # configure the screen for our needs @@ -229,28 +230,34 @@ def levelOptionsMenu(data): # refresh and wait for valid user input data.screen.refresh() - c = data.screen.getstr() + c = data.screen.getch() # process input - if c == ord('1'): playGameMenu(data) - elif c == ord('c'): changePlayerMenu(data) - elif c == ord('e'): pass + if c == ord('p'): start.startGame(data) # TODO remove the recursiveness of the menu system + elif c == ord('m'): mainMenu(data) else: levelOptionsMenu(data) def skillLevelMenu(data): - ''' ''' - # check for required vars - - # clear the screen and display the title - # display the menu - # refresh the screen - # wait for input - # process input + '''Displays the 'Skill Level' menu and handles its input''' + # TODO: + # check for required vars + # clear the screen and display the title + # display the menu + # refresh the screen + # wait for input + # process input pass def numberOfPlayersMenu(data): - ''' ''' + '''Displays the 'Number of Players' menu and handles its input''' + # TODO: + # check for required vars + # clear the screen and display the title + # display the menu + # refresh the screen + # wait for input + # process input pass # ----------------------------------------------------------------------------- @@ -276,7 +283,7 @@ def displayPrompt(screen, lines, offset=0): # ----------------------------------------------------------------------------- def init(stdscr): - ''' ''' + '''Enters the menu system''' # create the menu's data data = MenuData() @@ -288,6 +295,6 @@ def init(stdscr): mainMenu(data) def begin(): - ''' ''' + '''Configures Curses''' curses.wrapper(init) |