From a338dac3c7e4926602e40090e11ddb45e7dde0e0 Mon Sep 17 00:00:00 2001 From: Brian Caine Date: Sun, 25 Nov 2007 15:11:24 -0500 Subject: [PATCH] Well, I've started to do Justin's parts. Yep, I've got the text rendering correctly. But I don't know if transparency will work in general, but meh, I've got something done. --- TODO | 14 ++++++-------- game_client.py | 19 +++++++++++++++++++ pack_out/run.xml | 17 +++++++++++++---- pygame_gui/DerGUI.py | 34 +++++++++++++++++++--------------- pygame_gui/widgets.xml | 4 ++-- 5 files changed, 59 insertions(+), 29 deletions(-) diff --git a/TODO b/TODO index ef988c3..5abe83c 100644 --- a/TODO +++ b/TODO @@ -8,17 +8,15 @@ be done. Justin's TODO List: -1. Play with the GUI. The test_suite.py file is the current version of -the gui. you may need to update your zipfiles with ./update_zip.sh, from -within the pygame_gui/ directory. As you can see, we're having a -transparency problem we didn't have before, so you can compare with -temp.py and DerCrapGUI.py. -2. Get the text to draw properly. +1. [DONE, by canine] +2. [DONE, by canine] 3. Add a function to the GUISystem class that allows you to add an image. It'll be a surface containing the new image. Also, add an image widget. +4. Add some option for a gui theme to specify font size, name and color. +5. Add a listbox widget. Brian's TODO List: -1. Work on the GUI. -2. Add support for gui nesting. +1. Work on the new version. +2. Get 3d stuff to work. diff --git a/game_client.py b/game_client.py index a3a2136..b0894d0 100644 --- a/game_client.py +++ b/game_client.py @@ -355,6 +355,7 @@ class Engine: glLoadIdentity() if self.change: + self.lamina_screen.clear() self.gui_system.draw(self.lamina_screen.surf) self.lamina_screen.refresh() self.lamina_screen.display() @@ -490,10 +491,26 @@ class Engine: def showMenu(self, menu_name): + found = 0 + for file, contents in self.files.iteritems(): for name, menu in contents['menu_instances'].iteritems(): if contents['menu_instances'].has_key(menu_name): contents['menu_instances'][menu_name].show() + found = 1 + + new_menu = None + + if not found: + for file in self.files: + contents = self.files[file] + for name in contents['menu_defs']: + menu = contents['menu_defs'][name] + if name == menu_name: + new_menu = Menu(name, contents['menu_defs'][name]['elements'], self) + new_menu.show() + + self.files[file]['menu_instances'][name] = new_menu return @@ -511,6 +528,8 @@ class Engine: self.hideAllMenus() self.showMenu(menu_name) + self.change = 1 + return def addFile(self, filename, parent=''): diff --git a/pack_out/run.xml b/pack_out/run.xml index 73b2ec3..9cbb65e 100644 --- a/pack_out/run.xml +++ b/pack_out/run.xml @@ -48,7 +48,7 @@ width="20" height="10" parent="background_image" - target="the_engine.setMenu('main_menu')" + target="self.engine.setMenu('main_menu')" text="Back to main menu..."> - +