@@ -248,6 +248,10 @@ class GuiApplication:
|
||||
def set_show_fps(self, show: bool):
|
||||
self._show_fps = show
|
||||
|
||||
@property
|
||||
def show_touches(self) -> bool:
|
||||
return self._show_touches
|
||||
|
||||
@property
|
||||
def target_fps(self):
|
||||
return self._target_fps
|
||||
|
||||
@@ -104,6 +104,9 @@ class Widget(abc.ABC):
|
||||
self._layout()
|
||||
ret = self._render(self._rect)
|
||||
|
||||
if gui_app.show_touches:
|
||||
self._draw_debug_rect()
|
||||
|
||||
# Keep track of whether mouse down started within the widget's rectangle
|
||||
if self.enabled and self.__was_awake:
|
||||
self._process_mouse_events()
|
||||
@@ -116,6 +119,10 @@ class Widget(abc.ABC):
|
||||
|
||||
return ret
|
||||
|
||||
def _draw_debug_rect(self) -> None:
|
||||
rl.draw_rectangle_lines(int(self._rect.x), int(self._rect.y),
|
||||
max(int(self._rect.width), 1), max(int(self._rect.height), 1), rl.RED)
|
||||
|
||||
def _process_mouse_events(self) -> None:
|
||||
hit_rect = self._hit_rect
|
||||
touch_valid = self._touch_valid()
|
||||
|
||||
Reference in New Issue
Block a user