diff options
| author | onelin <oscar@nelin.dk> | 2025-04-10 21:41:08 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-04-10 21:41:08 +0000 |
| commit | 0f12145db9f6b6856a785d33527406ae9ea35363 (patch) | |
| tree | c750a54390fb662fb38de7f600e77d492892e933 /src/core | |
| parent | 5a7c450282bc1164cd73e6a95c899a5bfeeeeb10 (diff) | |
Rename Platform struct
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/include/engine/core/platform.h | 8 | ||||
| -rw-r--r-- | src/core/include/engine/engine.h | 8 | ||||
| -rw-r--r-- | src/core/src/loop.c | 12 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/core/include/engine/core/platform.h b/src/core/include/engine/core/platform.h index 675766b..327bf02 100644 --- a/src/core/include/engine/core/platform.h +++ b/src/core/include/engine/core/platform.h @@ -19,7 +19,7 @@ extern "C" { * variable (yeah, im sorry). Due to this design flaw the engine as a whole is * not quite thread safe. */ -typedef struct Platform { +typedef struct Instance { Window* window; bool quit; @@ -27,7 +27,9 @@ typedef struct Platform { u64 frame; u16 fps_target; - /* TODO: Move mouse data to input ctx */ + /* TODO: Move mouse data to input ctx/bindings */ + /* TODO: Move input ctx/bindings to window */ + /* TODO: Move cam to window->renderer */ v2_i32 mouse_pos; v2_i32 mousedown; @@ -49,7 +51,7 @@ typedef struct Platform { usize bindings_len; binding_t bindings_global[NUM_GLOBAL_BINDINGS]; -} Platform; +} Instance; #ifdef __cplusplus } diff --git a/src/core/include/engine/engine.h b/src/core/include/engine/engine.h index 0b1a540..d28c024 100644 --- a/src/core/include/engine/engine.h +++ b/src/core/include/engine/engine.h @@ -30,16 +30,16 @@ typedef struct { #include <cglm/cglm.h> /* Essential functions */ -Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight, +Instance* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight, const f32 render_scale, const u32 flags, const usize initial_memory); -i32 engine_run(Platform* p, StateType initial_state, void* state_arg); +i32 engine_run(Instance* p, StateType initial_state, void* state_arg); -void engine_stop(Platform* p); +void engine_stop(Instance* p); /* Utility functions */ -void engine_fps_max(Platform* p, u16 cap); +void engine_fps_max(Instance* p, u16 cap); void render_set_zoom(f32 new_zoom); void render_adjust_zoom(f32 diff); diff --git a/src/core/src/loop.c b/src/core/src/loop.c index cff8d64..6a91f46 100644 --- a/src/core/src/loop.c +++ b/src/core/src/loop.c @@ -37,7 +37,7 @@ #define DEFAULT_NUM_PROCS 8 -Platform* GLOBAL_PLATFORM = NULL; +Instance* GLOBAL_PLATFORM = NULL; static Camera default_camera = { .pos = {3, 0, 0}, @@ -100,7 +100,7 @@ i32 cmp_int(const void* a, const void* b) { /* Creates the window, initializes IO, Rendering, Fonts and engine-specific * resources. */ -Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight, +Instance* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight, const f32 render_scale, const u32 flags, const usize initial_memory) { @@ -115,7 +115,7 @@ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight #endif v2_i32 windowsize = (v2_i32){.x = windowWidth, .y = windowHeight}; - Platform* p = (Platform*)calloc(1, sizeof(Platform)); + Instance* p = (Instance*)calloc(1, sizeof(Instance)); Window* w = (Window*)calloc(1, sizeof(Window)); /* initialize resources */ @@ -275,7 +275,7 @@ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight return p; } -i32 engine_run(Platform* p, StateType initial_state, void* state_arg) { +i32 engine_run(Instance* p, StateType initial_state, void* state_arg) { if (p == NULL) { ERROR("Platform is uninitialized.\n"); @@ -396,7 +396,7 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) { return 0; } -void engine_stop(Platform* p) { +void engine_stop(Instance* p) { if (p == NULL) return; //{ /* Deallocate resources */ @@ -419,7 +419,7 @@ void engine_stop(Platform* p) { } /* Set the maximum framerate */ -void engine_fps_max(Platform* p, u16 cap) { +void engine_fps_max(Instance* p, u16 cap) { LOG("Setting max fps to %llu", cap); p->fps_target = cap; } |
