Commits

Nikhil Marathe  committed 411a02c

Change camera/state event handling order and disable camera motion
in most states.

  • Participants
  • Parent commits db5ddfe

Comments (0)

Files changed (2)

File src/fileadelphia/main.py

         glLoadIdentity()
 
     def handle_keypress(self, event, x, y):
+        if self.state.handle_keypress(event, x, y, self): return
         if self.camera.handle_keypress(event, x, y): return
-        if self.state.handle_keypress(event, x, y, self): return
 
         # do any remaining handling here
 
     def handle_mouse(self, button, state, x, y):
         self.logger.debug("MOUSE %d, %d, %d, %d", button, state, x, y)
+        if self.state.handle_mouse(button, state, x, y): return
         if self.camera.handle_mouse(button, state, x, y): return
-        if self.state.handle_mouse(button, state, x, y): return
 
         # do any remaining handling here
 

File src/fileadelphia/states.py

     def handle_keypress(self, event, x, y, world):
         if event.key == K_UP and pygame.key.get_mods() & KMOD_ALT:
             world.pop_state()
-            return True
-
-        return False
+        return True # always return True to disable camera motion
                     
     def display(self):
 
         glPopMatrix()
         glMatrixMode(GL_MODELVIEW)
 
+    def handle_keypress(self, event, x, y, world):
+        return True # always return True to disable camera motion
+
 class PermissionDeniedState(State):
 
     def __init__(self, path):
             self.dst.update(world, delta)
 
     def handle_keypress(self, event, x, y, world):
+        # don't allow any interaction while transitioning
+        return True
         self.src.handle_keypress(event, x, y, world)
         self.dst.handle_keypress(event, x, y, world)
 
     def handle_mouse(self, button, state, x, y):
+        # don't allow any interaction while transitioning
+        return True
         self.src.handle_mouse(button, state, x, y)
         self.dst.handle_mouse(button, state, x, y)