Mercurial > pyntnclick
comparison gamelib/popupmenu.py @ 84:c76f2fad2af5
Draw CursorWidget on top of StateWidget
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Mon, 23 Aug 2010 23:58:11 +0200 |
parents | 213e47dea4d0 |
children | ca10d7e9a2c1 |
comparison
equal
deleted
inserted
replaced
83:4fd56ee2af61 | 84:c76f2fad2af5 |
---|---|
1 # popmenu.py | 1 # popmenu.py |
2 # Copyright Boomslang team (see COPYING file) | 2 # Copyright Boomslang team (see COPYING file) |
3 # Popup menu for the game screen | 3 # Popup menu for the game screen |
4 | 4 |
5 from constants import BUTTON_SIZE | 5 from constants import BUTTON_SIZE |
6 from cursor import CursorWidget | |
7 | 6 |
8 from albow.menu import Menu | 7 from albow.menu import Menu |
9 from albow.controls import Button | 8 from albow.controls import Button |
10 from albow.resource import get_font | 9 from albow.resource import get_font |
11 from pygame.rect import Rect | 10 from pygame.rect import Rect |
12 | 11 |
13 class PopupMenuButton(Button, CursorWidget): | 12 class PopupMenuButton(Button): |
14 | 13 |
15 def __init__(self, text, action): | 14 def __init__(self, text, action): |
16 Button.__init__(self, text, action) | 15 Button.__init__(self, text, action) |
17 | 16 |
18 self.font = get_font(16, 'Vera.ttf') | 17 self.font = get_font(16, 'Vera.ttf') |
19 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) | 18 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) |
20 self.margin = (BUTTON_SIZE - self.font.get_linesize()) / 2 | 19 self.margin = (BUTTON_SIZE - self.font.get_linesize()) / 2 |
21 | |
22 def get_cursor(self, event): | |
23 # Draw standard arrow, not the sprite cursor | |
24 return None | |
25 | 20 |
26 class PopupMenu(Menu): | 21 class PopupMenu(Menu): |
27 | 22 |
28 def __init__(self, shell): | 23 def __init__(self, shell): |
29 self.shell = shell | 24 self.shell = shell |