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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. from . import gbe
  2. from .nodes import *
  3. from . import scenes
  4. _RUNNING = False
  5. def _OnQuit(event, data):
  6. global _RUNNING
  7. _RUNNING = False
  8. def _OnVideoResize(event, data):
  9. flags = gbe.display.Display.flags
  10. gbe.display.Display.set_mode(data["size"], flags)
  11. print("Resized to {}".format(gbe.display.Display.resolution))
  12. def _OnKeyEvent(event, data):
  13. global _RUNNING
  14. if event == "KEYDOWN":
  15. if data["key"] == 27:
  16. _RUNNING = False
  17. print("Key {} down".format(data["key_name"]))
  18. elif event == "KEYUP":
  19. print("Key {} up".format(data["key_name"]))
  20. elif event == "KEYPRESSED":
  21. print("Key {} pressed".format(data["key_name"]))
  22. def start():
  23. global _RUNNING, _OnKeyEvent, _OnQuit, _OnVideoResize
  24. sm = gbe.statemachine.StateMachine()
  25. gbe.events.Events.listen("QUIT", _OnQuit)
  26. #gbe.events.Events.listen("KEYDOWN", _OnKeyEvent)
  27. #gbe.events.Events.listen("KEYUP", _OnKeyEvent)
  28. #gbe.events.Events.listen("KEYPRESSED", _OnKeyEvent)
  29. d = gbe.display.Display
  30. d.init(640, 480)
  31. d.caption = "Goldbox 64"
  32. d.watch_for_resize(True)
  33. d.set_clear_color(0,0,0)
  34. #root = NodeInterface()
  35. #root.scale_to_display = True
  36. #root.keep_aspect_ratio = True
  37. #root.align_center = True
  38. #root.set_surface((64, 64))
  39. #sprite = gbe.nodes.NodeSprite("Sprite", root)
  40. #sprite.image = "maptiles/Walls.png"
  41. #sprite.rect = (48, 32, 16, 16)
  42. #sprite.position = (20, 20)
  43. #text = gbe.nodes.NodeText("TextNode", root)
  44. #text.font_src = "IttyBitty.ttf"
  45. #text.size = 4
  46. #text.antialias = False
  47. #text.text = "ObsidianBlk 123456"
  48. #text.set_color(255, 64, 128)
  49. #text.position_y = 30
  50. sm.register_node(scenes.mainmenu.get())
  51. sm.register_node(scenes.editor.get())
  52. sm.activate_node("MAIN_MENU")
  53. _RUNNING = True
  54. while _RUNNING:
  55. gbe.events.pollEmitter()
  56. sm.update()
  57. sm.render()
  58. sm.close()
  59. d.close()