changeset 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 773dc1dbe69d
files demos/rpg/gui/credits.txt demos/rpg/gui/credits.xml demos/rpg/gui/mainmenu.xml demos/rpg/scripts/gamecontroller.py demos/rpg/scripts/rpg.py
diffstat 5 files changed, 65 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/rpg/gui/credits.txt	Thu May 20 21:12:23 2010 +0000
@@ -0,0 +1,11 @@
+--== FIFE RPG Demo ==-        
+
+This demo was created by the FIFE team to show the 
+versatility of the FIFEngine.  We hope that it 
+will attract some new projects to use FIFE so we 
+can grow our community!
+
+Thanks for checking this demo out,
+
+The FIFE team!
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/rpg/gui/credits.xml	Thu May 20 21:12:23 2010 +0000
@@ -0,0 +1,17 @@
+<Container base_color="0,0,0" border_size="0" opaque="0" position="0,0" name="Credits" size="1024,768">
+	<VBox name="credits" position="312,200" opaque="1" base_color="188,0,0">
+		<HBox>
+			<Spacer />
+			<Label name="credits" border_size="0" text="Credits" />
+			<Spacer />
+		</HBox>
+		<HBox>
+			<ScrollArea min_size="400,400" max_size="400,400" size="400,400" vertical_scrollbar="1">
+				<TextBox name="creditText" filename="gui/credits.txt"/>
+			</ScrollArea>
+		</HBox>
+		<HBox>
+			<Button name="close" text="Close"/>
+		</HBox>
+	</VBox>
+</Container>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/rpg/gui/mainmenu.xml	Thu May 20 21:12:23 2010 +0000
@@ -0,0 +1,14 @@
+<Container name="MainMenu" position="0,0" size="1024,768" border_size="0" base_color="0,0,0" opaque="0">
+
+<!--
+	<Icon image="gui/backgrounds/800_main_bg.png" position="0,0" size="1024,768" name="main_background_icon"/>
+-->
+
+	<VBox opaque='0' base_color="188, 0, 0" position="412,200" name="main_menu">
+		<Button name="new_game" text="New Game" min_size="200,0" border_size="0"/>
+		<Button name="settings" text="Settings" min_size="200,0" border_size="0"/>
+		<Button name="credits" text="Credits" min_size="200,0" border_size="0"/>
+		<Button name="quit" text="Quit" min_size="200,0" border_size="0"/>
+	</VBox>
+
+</Container>
--- a/demos/rpg/scripts/gamecontroller.py	Thu May 20 19:55:19 2010 +0000
+++ b/demos/rpg/scripts/gamecontroller.py	Thu May 20 21:12:23 2010 +0000
@@ -28,11 +28,30 @@
 
 from fife import fife
 
+from scripts.guicontroller import GUIController
+
 class GameController(object):
 	def __init__(self, application, engine, settings):
 		self._application = application
 		self._engine = engine
 		self._settings = settings
 		
+		self._guicontroller = GUIController(self, self._engine, self._settings)
+		
+		self._guicontroller.showMainMenu()
+	
+	def onConsoleCommand(self, command):
+		"""
+		Might be useful if you want to have the game parse a command
+		"""
+		result = ""
+		return result
+		
+	def newGame(self):
+		pass
+		
+	def quit(self):
+		self._application.requestQuit()
+
 	def pump(self):
 		pass
--- a/demos/rpg/scripts/rpg.py	Thu May 20 19:55:19 2010 +0000
+++ b/demos/rpg/scripts/rpg.py	Thu May 20 21:12:23 2010 +0000
@@ -64,10 +64,10 @@
 			self.quit = True
 			evt.consume()
 		elif keyval == fife.Key.F10:
-			self.engine.getGuiManager().getConsole().toggleShowHide()
+			self._engine.getGuiManager().getConsole().toggleShowHide()
 			evt.consume()
 		elif keystr == 'p':
-			self.engine.getRenderBackend().captureScreen('screenshot.png')
+			self._engine.getRenderBackend().captureScreen('screenshot.png')
 			evt.consume()
 
 	def onCommand(self, command):
@@ -81,11 +81,11 @@
 			self.quit = True
 			result = 'quitting'
 		elif command.lower() in ( 'help', 'help()' ):
-			self.engine.getGuiManager().getConsole().println( open( 'misc/infotext.txt', 'r' ).read() )
+			self._engine.getGuiManager().getConsole().println( open( 'misc/infotext.txt', 'r' ).read() )
 			result = "-- End of help --"
 		else:
 			pass
-			#result = self.world.onConsoleCommand(command)
+			result = self._gamecontroller.onConsoleCommand(command)
 		if not result:
 			try:
 				result = str(eval(command))