comparison demos/rpg/scripts/rpg.py @ 510:cd959b05a262

There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 20 May 2010 21:12:23 +0000
parents 3951042a701e
children 6ddb1eb9dfa6
comparison
equal deleted inserted replaced
509:3951042a701e 510:cd959b05a262
62 consumed = False 62 consumed = False
63 if keyval == fife.Key.ESCAPE: 63 if keyval == fife.Key.ESCAPE:
64 self.quit = True 64 self.quit = True
65 evt.consume() 65 evt.consume()
66 elif keyval == fife.Key.F10: 66 elif keyval == fife.Key.F10:
67 self.engine.getGuiManager().getConsole().toggleShowHide() 67 self._engine.getGuiManager().getConsole().toggleShowHide()
68 evt.consume() 68 evt.consume()
69 elif keystr == 'p': 69 elif keystr == 'p':
70 self.engine.getRenderBackend().captureScreen('screenshot.png') 70 self._engine.getRenderBackend().captureScreen('screenshot.png')
71 evt.consume() 71 evt.consume()
72 72
73 def onCommand(self, command): 73 def onCommand(self, command):
74 self.quit = (command.getCommandType() == fife.CMD_QUIT_GAME) 74 self.quit = (command.getCommandType() == fife.CMD_QUIT_GAME)
75 if self.quit: 75 if self.quit:
79 result = '' 79 result = ''
80 if command.lower() in ('quit', 'exit'): 80 if command.lower() in ('quit', 'exit'):
81 self.quit = True 81 self.quit = True
82 result = 'quitting' 82 result = 'quitting'
83 elif command.lower() in ( 'help', 'help()' ): 83 elif command.lower() in ( 'help', 'help()' ):
84 self.engine.getGuiManager().getConsole().println( open( 'misc/infotext.txt', 'r' ).read() ) 84 self._engine.getGuiManager().getConsole().println( open( 'misc/infotext.txt', 'r' ).read() )
85 result = "-- End of help --" 85 result = "-- End of help --"
86 else: 86 else:
87 pass 87 pass
88 #result = self.world.onConsoleCommand(command) 88 result = self._gamecontroller.onConsoleCommand(command)
89 if not result: 89 if not result:
90 try: 90 try:
91 result = str(eval(command)) 91 result = str(eval(command))
92 except: 92 except:
93 pass 93 pass