예제 #1
0
 def ev_keydown(self, event: tcod.event.KeyDown) -> Optional[Action]:
     action: Optional[Action] = None
     key = event.sym
     if key == tcod.event.K_UP or key == tcod.event.K_k:
         action = MoveAction(0, -1)
     elif key == tcod.event.K_DOWN or key == tcod.event.K_j:
         action = MoveAction(0, 1)
     elif key == tcod.event.K_LEFT or key == tcod.event.K_h:
         action = MoveAction(-1, 0)
     elif key == tcod.event.K_RIGHT or key == tcod.event.K_l:
         action = MoveAction(1, 0)
     elif key == tcod.event.K_b:
         action = ToggleBlockingAction()
     elif key == tcod.event.K_v:
         action = ToggleFovAction()
     elif key == tcod.event.K_ESCAPE:
         action = QuitAction()
     return action
예제 #2
0
 def ev_quit(self, event: tcod.event.Quit) -> Optional[Action]:
     return QuitAction()