Legend of the Gold Box... A game written for the LOWREZJAM 2018 game jam
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

__init__.py 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from . import gbe
  2. _RUNNING = False
  3. def _OnVideoResize(event, data):
  4. flags = gbe.display.Display.flags
  5. gbe.display.Display.set_mode(data["size"], flags)
  6. print("Resized to {}".format(gbe.display.Display.resolution))
  7. def _OnKeyEvent(event, data):
  8. global _RUNNING
  9. if event == "KEYDOWN":
  10. if data["key"] == 27:
  11. _RUNNING = False
  12. print("Key {} down".format(data["key"]))
  13. elif event == "KEYUP":
  14. print("Key {} up".format(data["key"]))
  15. elif event == "KEYPRESSED":
  16. print("Key {} pressed".format(data["key"]))
  17. def start():
  18. global _RUNNING, _OnKeyEvent, _OnVideoResize
  19. t = gbe.time.Time()
  20. t.reset()
  21. gbe.events.Events.listen("KEYDOWN", _OnKeyEvent)
  22. gbe.events.Events.listen("KEYUP", _OnKeyEvent)
  23. gbe.events.Events.listen("KEYPRESSED", _OnKeyEvent)
  24. d = gbe.display.Display
  25. d.init()
  26. gbe.events.Events.listen("VIDEORESIZE", _OnVideoResize)
  27. _RUNNING = True
  28. while _RUNNING:
  29. gbe.events.pollEmitter()
  30. d.close()