diff options
| author | onelin <oscar@nelin.dk> | 2025-03-12 10:59:54 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-03-12 10:59:54 +0000 |
| commit | 3762bbc400a9d71a243def989912278c203bc76d (patch) | |
| tree | 56b7a3fe3b755f0a1b678a08e6c45aa7ea047d8c /src/core | |
| parent | 26a1ab291a6fe16db7d1b35d2f93b62a96d71c85 (diff) | |
Implement setting fps cap
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/include/engine/core/platform.h | 2 | ||||
| -rw-r--r-- | src/core/include/engine/engine.h | 2 | ||||
| -rw-r--r-- | src/core/src/loop.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/core/include/engine/core/platform.h b/src/core/include/engine/core/platform.h index 862cf97..675766b 100644 --- a/src/core/include/engine/core/platform.h +++ b/src/core/include/engine/core/platform.h @@ -25,7 +25,7 @@ typedef struct Platform { bool quit; u64 frame; - i32 fps_target; + u16 fps_target; /* TODO: Move mouse data to input ctx */ v2_i32 mouse_pos; diff --git a/src/core/include/engine/engine.h b/src/core/include/engine/engine.h index 0d5d2bc..51228fb 100644 --- a/src/core/include/engine/engine.h +++ b/src/core/include/engine/engine.h @@ -39,7 +39,7 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg); void engine_stop(Platform* p); /* Utility functions */ -void engine_fps_max(u64 cap); +void engine_fps_max(Platform* 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 95a405e..4f3d6d9 100644 --- a/src/core/src/loop.c +++ b/src/core/src/loop.c @@ -237,7 +237,7 @@ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight p->resources = resources; p->frame = 0; - p->fps_target = 60; + engine_fps_max(p, 0); p->mem = memory_new(initial_memory); @@ -421,7 +421,7 @@ void engine_stop(Platform* p) { } /* Set the maximum framerate */ -void engine_fps_max(u64 cap) { /* does nothing */ } +void engine_fps_max(Platform* p, u16 cap) { LOG("Setting max fps to %llu", cap); p->fps_target = cap; } isize f_get_sz(FILE* f) { if (f == NULL) { |
