Nimbin2git.christianimmanuel.de / Games / strichmaennchen / ui.h

strichmaennchen git · main

git clone https://git.christianimmanuel.de/games/strichmaennchen.gitwget https://git.christianimmanuel.de/games/strichmaennchen/archive/strichmaennchen.tar.gz
ui.h 704 B · 33 lines raw
#ifndef UI_H
#define UI_H

#include <SDL3_ttf/SDL_ttf.h>
#include <GL/gl.h>

#include "renderer.h"
#include "time.h"

typedef struct {
    TTF_Font *font;
    SDL_Color color;
    GLuint colorShader;

    GLuint texture;       // GL texture for current text
    int tex_w;
    int tex_h;

    GLuint shader;        // simple Ui shader
    GLuint vao;
    GLuint vbo;

    int screen_w;
    int screen_h;
    char last_text[64];   // simple cache to avoid re-uploading identical text
} Ui;

bool Ui_init(Ui *ui, Renderer *renderer, const char *font_path, int font_size);
void Ui_resize(Ui *ui, SDL_Window *window);
void Ui_render(Ui *ui, Renderer *renderer, Time *time);
void Ui_shutdown(Ui *ui);

#endif