#ifndef __G_GUI_H__
#define __G_GUI_H__

#include <gear/base.h>
#include <sokol/sokol_gfx.h>
#include <sokol/sokol_app.h>
#include <nuklear/nuklear_defines.h>
#include <sokol/util/sokol_nuklear.h>

typedef struct nk_context g_gui_context;

typedef void (*g_gui_layer_destroy_function)(void* data);
typedef struct g_gui_layer {
    const char* name;
    void* data;
    void (*draw)(g_gui_context* ctx, struct g_gui_layer* layer);
    g_gui_layer_destroy_function destroy;
} g_gui_layer;

typedef sl_vec(g_gui_layer*) g_gui_layers;
typedef g_gui_layer* (*g_gui_layer_create_function)();

typedef struct g_gui {
    g_gui_layers layers;
    g_gui_context* ctx;
} g_gui;

extern struct nk_font* g_gui_font;

// src/ui/gui/create.c
g_gui* g_gui_create();

// src/ui/gui/update.c
void g_gui_update(g_gui* gui);

// src/ui/gui/render.c
void g_gui_render(i32 width, i32 height);

// src/ui/gui/layers.c
void g_gui_add_layer(g_gui_layers* layers, g_gui_layer_create_function create_function, g_gui_layer_destroy_function destroy_function);

// src/ui/gui/destroy.c
void g_gui_destroy(g_gui* gui);

#endif
