mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-22 08:43:54 +08:00
raylib ui: common state update function (#35546)
* add _update_state * nonlya * visible already does this for us! * do hud renderer and exp button * temp * this really needs some type of timer like QT * this really needs some type of timer like QT * todo * use in model renderer * Revert "use in model renderer" This reverts commit d35f774155c9875209d06b8cd0b4849b1d8a60c4. * no passing rect * cl * unused now
This commit is contained in:
@@ -34,6 +34,8 @@ class Widget(abc.ABC):
|
||||
if rect is not None:
|
||||
self.set_rect(rect)
|
||||
|
||||
self._update_state()
|
||||
|
||||
if not self.is_visible:
|
||||
return None
|
||||
|
||||
@@ -56,6 +58,9 @@ class Widget(abc.ABC):
|
||||
def _render(self, rect: rl.Rectangle) -> bool | int | None:
|
||||
"""Render the widget within the given rectangle."""
|
||||
|
||||
def _update_state(self):
|
||||
"""Optionally update the widget's non-layout state. This is called before rendering."""
|
||||
|
||||
def _update_layout_rects(self) -> None:
|
||||
"""Optionally update any layout rects on Widget rect change."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user