From b501d40dfc59c5f68c5e0df6091dda8762035e55 Mon Sep 17 00:00:00 2001 From: 0scar Date: Sun, 11 Feb 2024 12:49:56 +0100 Subject: Purge UI --- src/core/include/engine/core/platform.h | 6 ++++-- src/core/include/engine/engine.h | 8 +++----- src/core/src/loop.c | 21 +++++++-------------- 3 files changed, 14 insertions(+), 21 deletions(-) (limited to 'src/core') diff --git a/src/core/include/engine/core/platform.h b/src/core/include/engine/core/platform.h index e0d2419..2e74fbe 100644 --- a/src/core/include/engine/core/platform.h +++ b/src/core/include/engine/core/platform.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #define NUM_GLOBAL_BINDINGS 1 @@ -15,8 +16,6 @@ * not quite thread safe. */ typedef struct Platform { - void* data; /* Contains textures and such */ - u64 data_len; Window window; bool quit; @@ -36,6 +35,9 @@ typedef struct Platform { i32 camera_x; i32 camera_y; + /* Global resources that live from engine_init to engine_free */ + Resources* resources; + /* Text input/editing is currently not used/implemented */ char* edit_text; usize edit_pos; diff --git a/src/core/include/engine/engine.h b/src/core/include/engine/engine.h index 11ee096..d5b0922 100644 --- a/src/core/include/engine/engine.h +++ b/src/core/include/engine/engine.h @@ -1,5 +1,5 @@ -#ifndef ENGINE_H -#define ENGINE_H +#ifndef ENGINE_ENGINE_H +#define ENGINE_ENGINE_H #include @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -27,8 +26,7 @@ typedef struct { /* Essential functions */ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight, const f32 render_scale, const u32 flags, - const usize initial_memory, const Asset_FontSpec* fonts[], - const Asset_TextureSpec* textures[]); + const usize initial_memory); i32 engine_run(Platform* p, StateType initial_state, void* state_arg); diff --git a/src/core/src/loop.c b/src/core/src/loop.c index 3974c78..f29ef25 100644 --- a/src/core/src/loop.c +++ b/src/core/src/loop.c @@ -23,6 +23,8 @@ #include #include +#include + #include #include @@ -72,8 +74,7 @@ void engine_update_window(Window* w, void* e) { * resources. */ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight, const f32 render_scale, const u32 flags, - const usize initial_memory, const Asset_FontSpec* fonts[], - const Asset_TextureSpec* textures[]) { + const usize initial_memory) { #if defined(__linux) || defined(__linux__) || defined(linux) { @@ -87,16 +88,8 @@ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight Window w = (Window)malloc(sizeof(Window)); /* initialize resources */ - struct Resources* resources = - (struct Resources*)malloc(sizeof(struct Resources)); - //resources->textures_len = 0; - //resources->fonts_len = 0; - //resources->texturepaths_len = 0; - //resources->fontpaths_len = 0; - //resources->texture_paths = NULL; - //resources->font_paths = NULL; - //resources->textures = NULL; - //resources->fonts = NULL; + Resources* resources = malloc(sizeof(Resources)); + // TODO: Initialize them :) w = init_window_glfw(windowtitle, (ivec2){windowsize.x, windowsize.y}, flags); // Dont forget to init the renderer @@ -317,11 +310,11 @@ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight // INFO("Windowsize: <%d,%d>", windowsize.x, windowsize.y); //} - p->data = (void*)resources; - p->data_len = sizeof(struct Resources); p->window = w; p->quit = false; + p->resources = resources; + p->frame = 0; p->fps_target = 60; -- cgit v1.3