__init__.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. from .print_tree import print_tree
  2. from .api import *
  3. from .gfx import Layer
  4. from . import settings
  5. class App(EventLoop):
  6. def __init__(self):
  7. super().__init__()
  8. w = get_property("/window", "width")
  9. h = get_property("/window", "height")
  10. self.chatbox_layer = Layer("chatbox_layer")
  11. self.chatbox_layer.resize(w, h)
  12. self.chatbox_layer.add_obj("outline")
  13. def resize_event(self, w, h):
  14. print(f"resize ({w}, {h})")
  15. self.chatbox_layer.resize(w, h)
  16. def mouse_click(self, x, y):
  17. print(f"mouse click ({x}, {y})")
  18. def mouse_wheel(self, y):
  19. settings.ui_scale *= 1 + y/100
  20. print(settings.ui_scale)
  21. def key_down(self, keycode, keymods, repeat):
  22. #print(f"key_down: '{keycode}'")
  23. if keymods.ctrl and keycode == "=":
  24. settings.ui_scale *= 1.01
  25. print(settings.ui_scale)
  26. elif keymods.ctrl and keycode == "-":
  27. settings.ui_scale *= 0.99
  28. print(settings.ui_scale)
  29. def main():
  30. garbage_collect()
  31. app = App()
  32. print_tree()
  33. app.run()