From 68c4834a62f0d80f1e572f6314ccc2548f839543 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 4 Nov 2025 08:46:47 -0600 Subject: [PATCH] Cursed input update --- src/input/input.c | 11 +++++++++++ src/input/input.h | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/input/input.c b/src/input/input.c index 5c154e3..1a77f97 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -116,6 +116,12 @@ void inputUpdate(void) { } float_t inputGetCurrentValue(const inputaction_t action) { + // This may be cursed, not sure yet! + if(TIME.fixedUpdate) return inputGetCurrentValueFixed(action); + return inputGetCurrentValueNonFixed(action); +} + +float_t inputGetCurrentValueFixed(const inputaction_t action) { assertTrue(action < INPUT_ACTION_COUNT, "Input action out of bounds"); return INPUT.actions[action].currentFixedValue; } @@ -126,6 +132,11 @@ float_t inputGetCurrentValueNonFixed(const inputaction_t action) { } float_t inputGetLastValue(const inputaction_t action) { + if(TIME.fixedUpdate) return inputGetLastValueFixed(action); + return inputGetLastValueNonFixed(action); +} + +float_t inputGetLastValueFixed(const inputaction_t action) { assertTrue(action < INPUT_ACTION_COUNT, "Input action out of bounds"); return INPUT.actions[action].lastFixedValue; } diff --git a/src/input/input.h b/src/input/input.h index 9aab7f3..2736a3e 100644 --- a/src/input/input.h +++ b/src/input/input.h @@ -47,6 +47,14 @@ void inputUpdate(void); */ float_t inputGetCurrentValue(const inputaction_t action); +/** + * Gets the current value of a specific input action (fixed timestep). + * + * @param action The input action to get the value for. + * @return The current value of the action (0.0f to 1.0f). + */ +float_t inputGetCurrentValueFixed(const inputaction_t action); + /** * Gets the current value of a specific input action (non-fixed timestep). * @@ -63,6 +71,14 @@ float_t inputGetCurrentValueNonFixed(const inputaction_t action); */ float_t inputGetLastValue(const inputaction_t action); +/** + * Gets the last value of a specific input action (fixed timestep). + * + * @param action The input action to get the value for. + * @return The last value of the action (0.0f to 1.0f). + */ +float_t inputGetLastValueFixed(const inputaction_t action); + /** * Gets the last value of a specific input action (non-fixed timestep). *