Mercurial > pyntnclick
comparison gamelib/hand.py @ 144:29ba5456e8b3
Removed a bunch of cruft.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Tue, 24 Aug 2010 22:57:09 +0200 |
parents | 97322b78d1c1 |
children | ef4da30f0f38 |
comparison
equal
deleted
inserted
replaced
143:d15270c2898c | 144:29ba5456e8b3 |
---|---|
10 | 10 |
11 | 11 |
12 class HandButton(ImageButton): | 12 class HandButton(ImageButton): |
13 """The fancy hand button for the widget""" | 13 """The fancy hand button for the widget""" |
14 | 14 |
15 sel_colour = Color('red') | |
16 sel_width = 2 | |
17 | |
18 def __init__(self, action): | 15 def __init__(self, action): |
19 # FIXME: Yes, please. | 16 # FIXME: Yes, please. |
20 this_image = get_image('items', 'hand.png') | 17 this_image = get_image('items', 'hand.png') |
21 ImageButton.__init__(self, image=this_image, action=action) | 18 ImageButton.__init__(self, image=this_image, action=action) |
22 self.selected = False # Flag if we're selected | |
23 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) | 19 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) |
24 | 20 |
25 def draw(self, surface): | |
26 """Draw the widget""" | |
27 ImageButton.draw(self, surface) | |
28 if self.selected: | |
29 rect = surface.get_rect().inflate(-self.sel_width, -self.sel_width) | |
30 frame_rect(surface, self.sel_colour, rect, self.sel_width) | |
31 | |
32 def toggle_selected(self): | |
33 self.selected = not self.selected | |
34 | |
35 def unselect(self): | |
36 self.selected = False | |
37 |