diff gamelib/cursor.py @ 171:a1162ea4ad67

Avoid cursor timing bug
author Neil Muller <neil@dip.sun.ac.za>
date Wed, 25 Aug 2010 12:41:08 +0200
parents a5972444ad1e
children 3b5cfb3f794e
line wrap: on
line diff
--- a/gamelib/cursor.py	Wed Aug 25 12:41:02 2010 +0200
+++ b/gamelib/cursor.py	Wed Aug 25 12:41:08 2010 +0200
@@ -35,6 +35,9 @@
         self.rect.top = pos[1] - self.pointer_y
 
     def set_highlight(self, enable):
+        if not hasattr(self, 'plain_image'):
+            # do nothing if we're not loaded yet
+            return
         if enable != self.highlighted:
             self.highlighted = enable
             self.image = self.plain_image.copy()