From f6922dc12deb981cf95498afeb939f24171a5fc4 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 16 Nov 2025 22:50:31 -0700 Subject: Testing widgets in the wm --- src/ui.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/ui.h') diff --git a/src/ui.h b/src/ui.h index 76d9b1f..95e250a 100644 --- a/src/ui.h +++ b/src/ui.h @@ -14,15 +14,18 @@ #define UI_WINDOW_TITLE_MAX 32 #define UI_WINDOW_MAX 4 -typedef void (*DrawWindowContentCallback)(Vector2 position, Vector2 scroll); +typedef struct FloatingWindow FloatingWindow; +typedef enum FocusCommand FocusCommand; +typedef FocusCommand (*DrawWindowContentCallback)(FloatingWindow* window, + Game* game); -typedef enum { +enum FocusCommand { NO_FOCUS_ACTION, REQUEST_FOCUS, DEMAND_FOCUS -} FocusCommand; +}; -typedef struct { +struct FloatingWindow { char title[UI_WINDOW_TITLE_MAX]; Rectangle rect; bool minimized; @@ -32,7 +35,8 @@ typedef struct { Vector2 contentSize; Vector2 scroll; bool hasFocus; -} FloatingWindow; + void* data; +}; typedef struct { FloatingWindow windows[UI_WINDOW_MAX]; @@ -40,10 +44,10 @@ typedef struct { } WindowManager; FloatingWindow createFloatingWindow(const char* title, Rectangle rect); -FocusCommand updateFloatingWindow(FloatingWindow* window); +FocusCommand updateFloatingWindow(FloatingWindow* window, Game* game); void initWindowManager(WindowManager* wm); -void updateWindowManager(WindowManager* wm); +void updateWindowManager(WindowManager* wm, Game* game); void addWindowToWindowManager(WindowManager* wm, FloatingWindow window); void focusOnWindow(WindowManager* wm, int windowIndex); -- cgit v1.2.3