Mercurial > pyntnclick
comparison gamelib/gamescreen.py @ 69:d4bbb26099cc
Some debug object cleanup.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Mon, 23 Aug 2010 20:50:36 +0200 |
parents | 05346a412b55 |
children | 213e47dea4d0 |
comparison
equal
deleted
inserted
replaced
68:158a13a48d48 | 69:d4bbb26099cc |
---|---|
79 # TODO: Randomly plonk the state here for now | 79 # TODO: Randomly plonk the state here for now |
80 self.state = initial_state() | 80 self.state = initial_state() |
81 self.state_widget = StateWidget(self.state) | 81 self.state_widget = StateWidget(self.state) |
82 self.add(self.state_widget) | 82 self.add(self.state_widget) |
83 | 83 |
84 AddItemButton = Button('Add item', action = self.add_item) | |
85 menu = Column([ | |
86 AddItemButton, | |
87 Button('Use hand', action = lambda: self.state.scenes['cryo'].things['cryo.door'].interact(None)), | |
88 Button('Use triangle', action = lambda: self.state.scenes['cryo'].things['cryo.door'].interact(self.state.items['triangle'])), | |
89 Button('Use titanium_leg', action = lambda: self.state.scenes['cryo'].things['cryo.door'].interact(self.state.items['titanium_leg'])), | |
90 ], align='l', spacing=20) | |
91 self.add_centered(menu) | |
92 self.popup_menu = PopupMenu(shell) | 84 self.popup_menu = PopupMenu(shell) |
93 self.menubutton = Button('Menu', action=self.popup_menu.show_menu) | 85 self.menubutton = Button('Menu', action=self.popup_menu.show_menu) |
94 self.menubutton.font = get_font(16, 'Vera.ttf') | 86 self.menubutton.font = get_font(16, 'Vera.ttf') |
95 self.menubutton.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) | 87 self.menubutton.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) |
96 self.menubutton.bottomleft = self.bottomleft | 88 self.menubutton.bottomleft = self.bottomleft |
106 self.inventory.get_rect().move_ip(2 * BUTTON_SIZE, 0) | 98 self.inventory.get_rect().move_ip(2 * BUTTON_SIZE, 0) |
107 self.add(self.inventory) | 99 self.add(self.inventory) |
108 | 100 |
109 # Test items | 101 # Test items |
110 self.state.add_inventory_item('triangle') | 102 self.state.add_inventory_item('triangle') |
111 self.state.add_inventory_item('titanium_leg') | |
112 | 103 |
113 | 104 |
114 # Albow uses magic method names (command + '_cmd'). Yay. | 105 # Albow uses magic method names (command + '_cmd'). Yay. |
115 # Albow's search order means they need to be defined here, not in | 106 # Albow's search order means they need to be defined here, not in |
116 # PopMenu, which is annoying. | 107 # PopMenu, which is annoying. |
119 return | 110 return |
120 | 111 |
121 def main_menu_cmd(self): | 112 def main_menu_cmd(self): |
122 self.shell.show_screen(self.shell.menu_screen) | 113 self.shell.show_screen(self.shell.menu_screen) |
123 | 114 |
115 def quit_cmd(self): | |
116 self.shell.quit() | |
117 | |
124 def add_item(self): | 118 def add_item(self): |
125 self.state.add_inventory_item("triangle") | 119 self.state.add_inventory_item("triangle") |
126 | 120 |
127 def hand_pressed(self): | 121 def hand_pressed(self): |
128 self.handbutton.toggle_selected() | 122 self.handbutton.toggle_selected() |