Mercurial > boomslang
comparison gamelib/state.py @ 139:a5972444ad1e
Improve cursor state handling, disable highlights on modal dialogs
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Tue, 24 Aug 2010 22:02:22 +0200 |
parents | 17411b984dc2 |
children | 5e5d71e40e54 |
comparison
equal
deleted
inserted
replaced
138:0fe0a91c4296 | 139:a5972444ad1e |
---|---|
303 | 303 |
304 Item may be an item in the list of items or None for the hand. | 304 Item may be an item in the list of items or None for the hand. |
305 """ | 305 """ |
306 if self._current_thing is not None: | 306 if self._current_thing is not None: |
307 if self._current_thing.contains(pos): | 307 if self._current_thing.contains(pos): |
308 self.state.screen.cursor_highlight(True) | |
308 return | 309 return |
309 else: | 310 else: |
310 self._current_thing.leave() | 311 self._current_thing.leave() |
311 self._current_thing = None | 312 self._current_thing = None |
312 self._current_description = None | 313 self._current_description = None |
315 thing.enter(item) | 316 thing.enter(item) |
316 self._current_thing = thing | 317 self._current_thing = thing |
317 self._current_description = self._make_description( | 318 self._current_description = self._make_description( |
318 thing.get_description()) | 319 thing.get_description()) |
319 break | 320 break |
321 self.state.screen.cursor_highlight(self._current_thing is not None) | |
320 | 322 |
321 def get_detail_size(self): | 323 def get_detail_size(self): |
322 return self._background.get_size() | 324 return self._background.get_size() |
323 | 325 |
324 | 326 |
493 def is_interactive(self): | 495 def is_interactive(self): |
494 return self.current_interact is not None | 496 return self.current_interact is not None |
495 | 497 |
496 def enter(self, item): | 498 def enter(self, item): |
497 """Called when the cursor enters the Thing.""" | 499 """Called when the cursor enters the Thing.""" |
498 self.state.screen.cursor_highlight(True) | 500 pass |
499 | 501 |
500 def leave(self): | 502 def leave(self): |
501 """Called when the cursr leaves the Thing.""" | 503 """Called when the cursr leaves the Thing.""" |
502 self.state.screen.cursor_highlight(False) | 504 pass |
503 | 505 |
504 def interact(self, item): | 506 def interact(self, item): |
505 if not self.is_interactive(): | 507 if not self.is_interactive(): |
506 return | 508 return |
507 if item is None: | 509 if item is None: |