Mercurial > boomslang
comparison gamelib/popupmenu.py @ 70:213e47dea4d0
Funkier cursor handling
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Mon, 23 Aug 2010 20:54:04 +0200 |
parents | d4bbb26099cc |
children | c76f2fad2af5 |
comparison
equal
deleted
inserted
replaced
69:d4bbb26099cc | 70:213e47dea4d0 |
---|---|
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 | |
6 | 7 |
7 from albow.menu import Menu | 8 from albow.menu import Menu |
9 from albow.controls import Button | |
8 from albow.resource import get_font | 10 from albow.resource import get_font |
11 from pygame.rect import Rect | |
12 | |
13 class PopupMenuButton(Button, CursorWidget): | |
14 | |
15 def __init__(self, text, action): | |
16 Button.__init__(self, text, action) | |
17 | |
18 self.font = get_font(16, 'Vera.ttf') | |
19 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) | |
20 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 | |
9 | 25 |
10 class PopupMenu(Menu): | 26 class PopupMenu(Menu): |
11 | 27 |
12 def __init__(self, shell): | 28 def __init__(self, shell): |
13 self.shell = shell | 29 self.shell = shell |