comparison gamelib/popupmenu.py @ 116:ca10d7e9a2c1

And CursorWidget-ify the popup menu.
author Jeremy Thurgood <firxen@gmail.com>
date Tue, 24 Aug 2010 14:56:39 +0200
parents c76f2fad2af5
children 97322b78d1c1
comparison
equal deleted inserted replaced
115:5e704ee7b84b 116:ca10d7e9a2c1
7 from albow.menu import Menu 7 from albow.menu import Menu
8 from albow.controls import Button 8 from albow.controls import Button
9 from albow.resource import get_font 9 from albow.resource import get_font
10 from pygame.rect import Rect 10 from pygame.rect import Rect
11 11
12 from cursor import CursorWidget
13
14
12 class PopupMenuButton(Button): 15 class PopupMenuButton(Button):
13 16
14 def __init__(self, text, action): 17 def __init__(self, text, action):
15 Button.__init__(self, text, action) 18 Button.__init__(self, text, action)
16 19
17 self.font = get_font(16, 'Vera.ttf') 20 self.font = get_font(16, 'Vera.ttf')
18 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE)) 21 self.set_rect(Rect(0, 0, BUTTON_SIZE, BUTTON_SIZE))
19 self.margin = (BUTTON_SIZE - self.font.get_linesize()) / 2 22 self.margin = (BUTTON_SIZE - self.font.get_linesize()) / 2
20 23
21 class PopupMenu(Menu): 24 class PopupMenu(Menu, CursorWidget):
22 25
23 def __init__(self, shell): 26 def __init__(self, shell):
27 CursorWidget.__init__(self)
24 self.shell = shell 28 self.shell = shell
25 items = [ 29 items = [
26 ('Resume Game', 'hide'), 30 ('Resume Game', 'hide'),
27 ('Quit Game', 'quit'), 31 ('Quit Game', 'quit'),
28 ('Exit to Main Menu', 'main_menu'), 32 ('Exit to Main Menu', 'main_menu'),