#include "utils.h" #ifndef UI_H #define UI_H #ifndef RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24 #endif #ifndef RAYGUI_WINDOW_CLOSEBUTTON_SIZE #define RAYGUI_WINDOW_CLOSEBUTTON_SIZE 18 #endif #define UI_WINDOW_TITLE_MAX 32 #define UI_WINDOW_MAX 4 typedef struct FloatingWindow FloatingWindow; typedef enum FocusCommand FocusCommand; typedef FocusCommand (*DrawWindowContentCallback)(FloatingWindow* window, Game* game); enum FocusCommand { NO_FOCUS_ACTION, REQUEST_FOCUS, DEMAND_FOCUS }; struct FloatingWindow { char title[UI_WINDOW_TITLE_MAX]; Rectangle rect; bool minimized; bool moving; bool resizing; DrawWindowContentCallback callback; Vector2 contentSize; Vector2 scroll; bool hasFocus; void* data; }; typedef struct { FloatingWindow windows[UI_WINDOW_MAX]; int windowCount; } WindowManager; FloatingWindow createFloatingWindow(const char* title, Rectangle rect); FocusCommand updateFloatingWindow(FloatingWindow* window, Game* game); void initWindowManager(WindowManager* wm); void updateWindowManager(WindowManager* wm, Game* game); void addWindowToWindowManager(WindowManager* wm, FloatingWindow window); void focusOnWindow(WindowManager* wm, int windowIndex); #endif