summaryrefslogtreecommitdiff
path: root/src/ctrl
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2025-03-13 17:48:58 +0000
committeronelin <oscar@nelin.dk>2025-03-13 17:55:55 +0000
commita9713cdda4df398cbcb3131cce47cdb6e6d87386 (patch)
treeba044f71ffa5a60024dd1341e78772adffe28159 /src/ctrl
parentbb170ff42b30dd44c2352bd2c93ad2974241721c (diff)
Use nanoseconds for time measurements
Diffstat (limited to 'src/ctrl')
-rw-r--r--src/ctrl/include/engine/ctrl/input.h2
-rw-r--r--src/ctrl/src/input.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/ctrl/include/engine/ctrl/input.h b/src/ctrl/include/engine/ctrl/input.h
index 73a265b..960428c 100644
--- a/src/ctrl/include/engine/ctrl/input.h
+++ b/src/ctrl/include/engine/ctrl/input.h
@@ -55,7 +55,7 @@ void i_ctx_t_free(i_ctx* c);
/* Executes all callbacks that has been pushed onto the callstack and resets the
* callstack */
void i_flush_bindings(f64 dt, usize numcalls, input_callback_t* c[], void* state_mem);
-action_t i_get_action(const i_ctx* restrict ctx, u32 time, scancode_t scancode);
+action_t i_get_action(const i_ctx* restrict ctx, u64 time, scancode_t scancode);
void key_callback(void* window, int key, int scancode, int action, int mods);
diff --git a/src/ctrl/src/input.c b/src/ctrl/src/input.c
index 4b878d1..4d29770 100644
--- a/src/ctrl/src/input.c
+++ b/src/ctrl/src/input.c
@@ -42,7 +42,7 @@ void key_callback(void* window, int key, int scancode, int action, int mods) {
const i_ctx* bindings = *GLOBAL_PLATFORM->bindings;
const usize bindings_len = GLOBAL_PLATFORM->bindings_len;
- const f64 now = get_time();
+ const u64 now = get_time();
for (usize b = 0; b < bindings_len; b++) {
const action_t a = i_get_action(&bindings[b], now, scancode);
@@ -190,6 +190,7 @@ bool i_update_unique_binding(i_ctx* ctx, binding_t* binding) {
return false;
}
+/* Call binding callbacks of respective bindings */
void i_flush_bindings(f64 dt, usize numcalls, input_callback_t* c[], void* state_mem) {
for (usize i = 0; i < numcalls; i++) {
(c[i])(state_mem);
@@ -198,7 +199,7 @@ void i_flush_bindings(f64 dt, usize numcalls, input_callback_t* c[], void* state
callbacks_len = 0;
}
-action_t i_get_action(const i_ctx* restrict ctx, u32 time,
+action_t i_get_action(const i_ctx* restrict ctx, u64 time,
scancode_t scancode) {
isize idx = 0;