#ifndef RENDER_UI_H #define RENDER_UI_H /* Minimal text overlay (SDL3_ttf). Draw last in the frame. */ #include #include #include "core/gl.h" #define UI_TEXT_MAX 96 #define UI_LABELS 141 typedef enum { UI_TOP_LEFT, UI_TOP_RIGHT, UI_CENTER, UI_BOTTOM_LEFT, } UiCorner; /* One line of text with its own texture; only re-rendered when it changes. */ typedef struct { GLuint texture; int width; int height; char text[UI_TEXT_MAX]; } UiLabel; typedef struct { TTF_Font *font; bool ttf_ready; GLuint program; GLint u_screen_size, u_tex, u_text_color, u_mode, u_rect_size, u_boil, u_rim; float boil_time; GLuint vao; GLuint vbo; UiLabel labels[UI_LABELS]; } Ui; bool Ui_init(Ui *ui, const char *font_asset, float font_size); void Ui_shutdown(Ui *ui); /* Draws a line of text into a corner. label (0..UI_LABELS-1) picks the text slot. */ void Ui_drawText(Ui *ui, int label, const char *text, UiCorner corner, int screen_w, int screen_h); /* Draws a line of a list down the left (UI_TOP_LEFT) or right side; line 0 is the top line. UI_BOTTOM_LEFT: a list up from the bottom left, line 0 the lowest, with a light halo. */ void Ui_drawTextLine(Ui *ui, int label, const char *text, int line, UiCorner side, int screen_w, int screen_h); /* The animation clock: letters and patches boil with the pictures. */ void Ui_setTime(Ui *ui, float seconds); /* Text with its left end at x, its bottom at y (pixels, y up), no halo. */ void Ui_drawTextLeft(Ui *ui, int label, const char *text, float x, float y, int screen_w, int screen_h); /* A painted paper patch (pixels, y up): color and opacity, ink rim 0..1. */ void Ui_drawPatch(Ui *ui, float x, float y, float w, float h, float r, float g, float b, float a, float rim, int screen_w, int screen_h); /* Speech: text centered on x, its bottom at y (pixels, y up), with a light halo. */ void Ui_drawTextAt(Ui *ui, int label, const char *text, float x, float y, int screen_w, int screen_h); #endif /* RENDER_UI_H */