Add circular fitting to lights.
[tabakrolletjie.git] / tabakrolletjie / scenes / night.py
index ae86c565be6340e2f7444019c8d2684d61ce1246..b3e00d24a9a8c85c185cb06456b747c8493bb97d 100644 (file)
@@ -3,15 +3,13 @@
 import pygame.locals as pgl
 
 import pymunk
 import pygame.locals as pgl
 
 import pymunk
-import time
 
 from .base import BaseScene
 from ..lights import BaseLight
 from ..obstacles import BaseObstacle
 from ..enemies import Boyd
 from ..events import SceneChangeEvent
 
 from .base import BaseScene
 from ..lights import BaseLight
 from ..obstacles import BaseObstacle
 from ..enemies import Boyd
 from ..events import SceneChangeEvent
-
-from ..constants import DEBUG
+from ..utils import debug_timer
 
 
 class NightScene(BaseScene):
 
 
 class NightScene(BaseScene):
@@ -28,20 +26,16 @@ class NightScene(BaseScene):
 
         self._mould = Boyd(gamestate, self._space)
 
 
         self._mould = Boyd(gamestate, self._space)
 
+    @debug_timer("night.render")
     def render(self, surface, gamestate):
     def render(self, surface, gamestate):
-        start_time = time.time()
         surface.fill((0, 0, 155))
         surface.fill((0, 0, 155))
+        self._mould.render(surface)
         for light in self._lights:
             light.render_light(surface)
         for obs in self._obstacles:
             obs.render(surface)
         for light in self._lights:
             light.render_fittings(surface)
         for light in self._lights:
             light.render_light(surface)
         for obs in self._obstacles:
             obs.render(surface)
         for light in self._lights:
             light.render_fittings(surface)
-        self._mould.render(surface)
-
-        end_time = time.time()
-        if DEBUG:
-            print "Night Render", end_time - start_time
 
     def event(self, ev, gamestate):
         if ev.type == pgl.KEYDOWN:
 
     def event(self, ev, gamestate):
         if ev.type == pgl.KEYDOWN:
@@ -52,9 +46,6 @@ class NightScene(BaseScene):
                 for light in self._lights:
                     light.toggle()
 
                 for light in self._lights:
                     light.toggle()
 
+    @debug_timer("night.tick")
     def tick(self, gamestate):
     def tick(self, gamestate):
-        start_time = time.time()
         self._mould.tick(gamestate, self._space)
         self._mould.tick(gamestate, self._space)
-        end_time = time.time()
-        if DEBUG:
-            print "Night Tick", end_time - start_time