MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / KeyboardControl

Class KeyboardControl

PythonAPI/examples/automatic_control.py:172–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170
171
172class KeyboardControl(object):
173 def __init__(self, world):
174 world.hud.notification("Press 'H' or '?' for help.", seconds=4.0)
175
176 def parse_events(self):
177 for event in pygame.event.get():
178 if event.type == pygame.QUIT:
179 return True
180 elif event.type == pygame.KEYUP:
181 if self._is_quit_shortcut(event.key):
182 return True
183
184 @staticmethod
185 def _is_quit_shortcut(key):
186 return (key == K_ESCAPE) or (key == K_q and pygame.key.get_mods() & KMOD_CTRL)
187
188# ==============================================================================
189# -- HUD -----------------------------------------------------------------------

Callers 1

game_loopFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected