Mercurial > boomslang
comparison gamelib/cursor.py @ 401:92029c76b687
Different toolbar colour and remove highlighted cursor outside scene widget.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 28 Aug 2010 21:30:15 +0200 |
parents | 3476e8f3b100 |
children | 0e8487038834 |
comparison
equal
deleted
inserted
replaced
400:0fd5796a1562 | 401:92029c76b687 |
---|---|
3 # Sprite Cursor | 3 # Sprite Cursor |
4 | 4 |
5 from albow.resource import get_image | 5 from albow.resource import get_image |
6 from albow.widget import Widget | 6 from albow.widget import Widget |
7 from pygame.sprite import Sprite, RenderUpdates | 7 from pygame.sprite import Sprite, RenderUpdates |
8 from pygame.rect import Rect | |
8 import pygame | 9 import pygame |
9 import pygame.color | 10 import pygame.color |
10 import pygame.cursors | 11 import pygame.cursors |
11 import pygame.mouse | 12 import pygame.mouse |
13 | |
14 from gamelib.constants import SCENE_SIZE | |
15 | |
12 | 16 |
13 class CursorSprite(Sprite): | 17 class CursorSprite(Sprite): |
14 "A Sprite that follows the Cursor" | 18 "A Sprite that follows the Cursor" |
15 | 19 |
16 def __init__(self, filename, x=None, y=None): | 20 def __init__(self, filename, x=None, y=None): |
100 cls.cursor.load() | 104 cls.cursor.load() |
101 cls._cursor_group.empty() | 105 cls._cursor_group.empty() |
102 cls._cursor_group.add(cls.cursor) | 106 cls._cursor_group.add(cls.cursor) |
103 | 107 |
104 def cursor_highlight(self): | 108 def cursor_highlight(self): |
109 if not Rect((0, 0), SCENE_SIZE).collidepoint(pygame.mouse.get_pos()): | |
110 return False | |
105 if self.screen.state.highlight_override: | 111 if self.screen.state.highlight_override: |
106 return True | 112 return True |
107 current_thing = self.screen.state.current_thing | 113 current_thing = self.screen.state.current_thing |
108 if current_thing: | 114 if current_thing: |
109 return current_thing.is_interactive() | 115 return current_thing.is_interactive() |