diff gamelib/state.py @ 282:fe899fb63866

Add option for turning off debugging rects while debugging.
author Simon Cross <hodgestar+bzr@gmail.com>
date Fri, 27 Aug 2010 23:09:07 +0200
parents d9b19449436f
children 75783238f73d
line wrap: on
line diff
--- a/gamelib/state.py	Fri Aug 27 23:01:17 2010 +0200
+++ b/gamelib/state.py	Fri Aug 27 23:09:07 2010 +0200
@@ -12,6 +12,9 @@
 # override the initial scene to for debugging
 DEBUG_SCENE = None
 
+# whether to show debugging rects
+DEBUG_RECTS = False
+
 class Result(object):
     """Result of interacting with a thing"""
 
@@ -362,10 +365,7 @@
 
     # Interact rectangle hi-light color (for debugging)
     # (set to None to turn off)
-    if constants.DEBUG:
-        _interact_hilight_color = Color('red')
-    else:
-        _interact_hilight_color = None
+    _interact_hilight_color = Color('red')
 
     def __init__(self):
         StatefulGizmo.__init__(self)
@@ -461,7 +461,7 @@
             self.current_interact.rect = old_rect.move(self.scene.OFFSET)
         self.current_interact.draw(surface)
         self.current_interact.rect = old_rect
-        if self._interact_hilight_color is not None:
+        if DEBUG_RECTS:
             if hasattr(self.rect, 'collidepoint'):
                 frame_rect(surface, self._interact_hilight_color,
                         self.rect.inflate(1, 1), 1)