import npyscreen from npyscreen import NotEnoughSpaceForWidget from os import system from yaml_parser import parse_datafile as parse from GameNavigator import GameNavigator from MainMenu import MainMenu class AlphaWarning(npyscreen.Popup): def afterEditing(self): self.parentApp.setNextForm('MENU') def create(self): self.add(npyscreen.Pager, values=['Welcome to Unnamed Adventure game!', 'Please enjoy your stay and report any bugs at', 'kitsunehosting.net'], editable=False) class AdventureGame(npyscreen.NPSAppManaged): # Do on creation def onStart(self): # Setup some important 'global' values we'll need later self.gamelib = parse( 'gamedata/gamelib.yaml') # parse this data first (since it includes graphics for the main menu self.player = None # Intalize the player as none, the player will be created in the main menu. # Set screen size before drawing windows dimensions = self.gamelib['menu']['graphics']['dimensions'] #system('mode con: cols={0} lines={1}'.format( # dimensions['inventory_width']+dimensions['art_width'], # 30)) # TODO: Finish setting this up. # Draw game windows self.addForm('GAME', GameNavigator, name='Unnamed Adventure Game') # This window should draw the actual game self.addForm('MENU', MainMenu, name='Welcome to the main menu') # This window should draw the main menu self.addForm('MAIN', AlphaWarning, name='Welcome to the alpha!') # This window is only needed for the ALPHA # TODO: Create a 'splash screen' or, traditional "main menu" if __name__ == '__main__': # Set the screen size bigger system('mode con: cols={0} lines={1}'.format(124, 36)) # Make a new adventure game if not imported adventure_game = AdventureGame() # Run the game! try: adventure_game.run() except NotEnoughSpaceForWidget: # This exception should catch if a player tries to play in a screen that is too small. print('Your screen is too small!\nOr, Joe has not fixed https://kitsunehosting.net/gitea/Kenwood/SNHU-IT-140/issues/7')