Mercurial > boomslang
comparison gamelib/gamescreen.py @ 66:05346a412b55
A sprite cursor attempt
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Mon, 23 Aug 2010 19:50:45 +0200 |
parents | cab924519037 |
children | d4bbb26099cc |
comparison
equal
deleted
inserted
replaced
65:cab924519037 | 66:05346a412b55 |
---|---|
1 # gamescreen.py | 1 # gamescreen.py |
2 # Copyright Boomslang team, 2010 (see COPYING File) | 2 # Copyright Boomslang team, 2010 (see COPYING File) |
3 # Main menu for the game | 3 # Main menu for the game |
4 | 4 |
5 from state import initial_state, Item | |
6 from hand import HandButton | |
7 from popupmenu import PopupMenu | |
8 from constants import BUTTON_SIZE | |
9 | |
10 from pygame.color import Color | |
11 from pygame import Rect | |
12 from pygame.locals import BLEND_ADD | |
13 from albow.screen import Screen | |
14 from albow.resource import get_font | |
15 from albow.controls import Button, Label, Widget | 5 from albow.controls import Button, Label, Widget |
16 from albow.layout import Column | 6 from albow.layout import Column |
17 from albow.palette_view import PaletteView | 7 from albow.palette_view import PaletteView |
8 from albow.resource import get_font | |
9 from pygame import Rect | |
10 from pygame.color import Color | |
11 from pygame.locals import BLEND_ADD | |
18 | 12 |
13 from constants import BUTTON_SIZE | |
14 from cursor import CursorSpriteScreen | |
15 from hand import HandButton | |
16 from popupmenu import PopupMenu | |
17 from state import initial_state, Item | |
19 | 18 |
20 class InventoryView(PaletteView): | 19 class InventoryView(PaletteView): |
21 | 20 |
22 sel_color = Color("yellow") | 21 sel_color = Color("yellow") |
23 sel_width = 2 | 22 sel_width = 2 |
70 def mouse_move(self, event): | 69 def mouse_move(self, event): |
71 if self.state.check_for_new_description(event.pos): | 70 if self.state.check_for_new_description(event.pos): |
72 # queue a redraw | 71 # queue a redraw |
73 self.invalidate() | 72 self.invalidate() |
74 | 73 |
75 class GameScreen(Screen): | 74 |
75 class GameScreen(CursorSpriteScreen): | |
76 def __init__(self, shell): | 76 def __init__(self, shell): |
77 Screen.__init__(self, shell) | 77 CursorSpriteScreen.__init__(self, shell) |
78 | 78 |
79 # TODO: Randomly plonk the state here for now | 79 # TODO: Randomly plonk the state here for now |
80 self.state = initial_state() | 80 self.state = initial_state() |
81 self.state_widget = StateWidget(self.state) | 81 self.state_widget = StateWidget(self.state) |
82 self.add(self.state_widget) | 82 self.add(self.state_widget) |