Legend of the Gold Box... A game written for the LOWREZJAM 2018 game jam
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0KB

  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()