Mercurial > boomslang
diff gamelib/gamescreen.py @ 73:932b0956e77a
Make tools usable.
author | Simon Cross <hodgestar+bzr@gmail.com> |
---|---|
date | Mon, 23 Aug 2010 21:19:34 +0200 |
parents | 99c5506de7ea |
children | 75e1040a1121 |
line wrap: on
line diff
--- a/gamelib/gamescreen.py Mon Aug 23 21:08:15 2010 +0200 +++ b/gamelib/gamescreen.py Mon Aug 23 21:19:34 2010 +0200 @@ -23,7 +23,6 @@ def __init__(self, state, handbutton): PaletteView.__init__(self, (BUTTON_SIZE, BUTTON_SIZE), 1, 6, scrolling=True) self.state = state - self.selection = None self.handbutton = handbutton def num_items(self): @@ -34,14 +33,14 @@ surface.blit(item_image, rect, None, BLEND_ADD) def click_item(self, item_no, event): - self.selection = item_no + self.state.set_tool(self.state.inventory[item_no]) self.handbutton.unselect() def item_is_selected(self, item_no): - return self.selection == item_no + return self.state.tool is self.state.inventory[item_no] def unselect(self): - self.selection = None + self.state.set_tool(None) class StateWidget(CursorWidget): @@ -66,12 +65,10 @@ print desc def mouse_down(self, event): - # TODO: replace None with the correct item - self.state.interact(None, event.pos) + self.state.interact(event.pos) def mouse_move(self, event): - # TODO: replace None with the correct item - self.state.mouse_move(None, event.pos) + self.state.mouse_move(event.pos) if self.state.check_for_new_description(event.pos): # queue a redraw self.invalidate()