[PATCH] Change grid drawing to happen earlier, outside of actor move drawing

Christopher Schmidt crschmidt at metacarta.com
Mon Aug 20 10:06:06 EDT 2007


to save on multiple calls to setanswers.

---

 kuku.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

f73baf4f58df71da781ed686f28a08e5d6bc2554
diff --git a/kuku.py b/kuku.py
index 0429050..3379064 100644
--- a/kuku.py
+++ b/kuku.py
@@ -752,6 +752,12 @@ def main():
                     state.won = 0             
                     high_score.set(state.high_score)
                     
+            if changed['grid']:
+                dirtyrects.extend(qa.display_question(screen,font))
+                qa.set_answers(screen,grid,font)
+                dirtyrects.extend(grid.draw(screen))
+                #questions and answers
+            
             if changed['actor'] or changed['grid']:    
                 # determine which direction the actor is facing
                 if x_direction in [-1,1]:
@@ -770,9 +776,6 @@ def main():
                 x_direction = 0
                 y_direction = 0
                 
-                #questions and answers
-                dirtyrects.extend(qa.display_question(screen,font))
-                qa.set_answers(screen,grid,font)
                 
                 for actor in [player]:
                     dirtyrects.append(actor.draw(screen))
@@ -791,8 +794,6 @@ def main():
             dirtyrects.extend(time_clock.draw())
             
             
-            if changed['grid']:
-               dirtyrects.extend(grid.draw(screen))
             #do the update
             pygame.display.update(dirtyrects)
             dirtyrects = []
-- 
1.2.4


--3V7upXqbjpZ4EhLz--


More information about the Games mailing list