ui: draw debug rects (#37313)

* debug

* new
This commit is contained in:
Shane Smiskol
2026-02-21 20:56:51 -08:00
committed by GitHub
parent 7cd9ab27e6
commit c4393277fb
2 changed files with 11 additions and 0 deletions

View File

@@ -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

View File

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