comparison pyntnclick/cursor.py @ 675:67373f9d2d20 pyntnclick

Renable cursor highlights. NAFC how it's working, but wth
author Stefano Rivera <stefano@rivera.za.net>
date Sun, 12 Feb 2012 19:01:53 +0200
parents dbec226debe3
children 6d75895477ac
comparison
equal deleted inserted replaced
674:94d3552bb4eb 675:67373f9d2d20
42 self.rect.left = pos[0] - self.pointer_x 42 self.rect.left = pos[0] - self.pointer_x
43 self.rect.top = pos[1] - self.pointer_y 43 self.rect.top = pos[1] - self.pointer_y
44 44
45 def set_highlight(self, enable): 45 def set_highlight(self, enable):
46 if enable != self.highlighted: 46 if enable != self.highlighted:
47 self.load() 47 # Do we need this? self.load()
48 self.highlighted = enable 48 self.highlighted = enable
49 self.image = self.plain_image.copy() 49 self.image = self.plain_image.copy()
50 if enable: 50 if enable:
51 self.image.blit(self.highlight, self.highlight.get_rect(), 51 self.image.blit(self.highlight, self.highlight.get_rect(),
52 None, pygame.BLEND_MULT) 52 None, pygame.BLEND_MULT)
72 pygame.mouse.set_visible(1) 72 pygame.mouse.set_visible(1)
73 73
74 def draw(self, surface): 74 def draw(self, surface):
75 super(CursorScreen, self).draw(surface) 75 super(CursorScreen, self).draw(surface)
76 self.set_cursor(self.game.tool) 76 self.set_cursor(self.game.tool)
77 #XXX: self.cursor.set_highlight(self.cursor_highlight()) 77 self._loaded_cursor.set_highlight(self.cursor_highlight())
78 self._cursor_group.update() 78 self._cursor_group.update()
79 self._cursor_group.draw(surface) 79 self._cursor_group.draw(surface)
80 80
81 def set_cursor(self, item): 81 def set_cursor(self, item):
82 if item is None or item.CURSOR is None: 82 if item is None or item.CURSOR is None:
90 self._cursor_group.add(self._loaded_cursor) 90 self._cursor_group.add(self._loaded_cursor)
91 91
92 def cursor_highlight(self): 92 def cursor_highlight(self):
93 #XXX: if not Rect((0, 0), SCENE_SIZE).collidepoint(pygame.mouse.get_pos()): 93 #XXX: if not Rect((0, 0), SCENE_SIZE).collidepoint(pygame.mouse.get_pos()):
94 #XXX: return False 94 #XXX: return False
95 if self.screen.game.highlight_override: 95 if self.game.highlight_override:
96 # TODO: What is this?
96 return True 97 return True
97 current_thing = self.screen.game.current_thing 98 current_thing = self.game.current_thing
98 if current_thing: 99 if current_thing:
99 return current_thing.is_interactive() 100 return current_thing.is_interactive()
100 return False 101 return False