#include <gear/ui/gui.h>
#include <gear/ui/console.h>
#include <sokol/sokol_log.h>
#include <log.c/log.h>

g_gui* g_gui_create() {
    snk_setup(&(snk_desc_t){
        .dpi_scale = sapp_dpi_scale(),
        .logger.func = slog_func,
    });
    log_info("Sokol nuklear initialized successfully");

    g_gui* gui = calloc(1, sizeof(g_gui));
    if(gui != NULL) {
        log_info("GUI allocated successfully");
        log_debug("GUI pointer: %p", gui);

        g_gui_add_layer(&gui->layers, g_console_create, g_console_destroy);
    } else {
        log_fatal("Failed to allocate GUI");
        exit(EXIT_FAILURE);
    }

    return gui;
}
