Cursed input update

This commit is contained in:
2025-11-04 08:46:47 -06:00
parent c9608ad7a7
commit 68c4834a62
2 changed files with 27 additions and 0 deletions

View File

@@ -116,6 +116,12 @@ void inputUpdate(void) {
} }
float_t inputGetCurrentValue(const inputaction_t action) { 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"); assertTrue(action < INPUT_ACTION_COUNT, "Input action out of bounds");
return INPUT.actions[action].currentFixedValue; return INPUT.actions[action].currentFixedValue;
} }
@@ -126,6 +132,11 @@ float_t inputGetCurrentValueNonFixed(const inputaction_t action) {
} }
float_t inputGetLastValue(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"); assertTrue(action < INPUT_ACTION_COUNT, "Input action out of bounds");
return INPUT.actions[action].lastFixedValue; return INPUT.actions[action].lastFixedValue;
} }

View File

@@ -47,6 +47,14 @@ void inputUpdate(void);
*/ */
float_t inputGetCurrentValue(const inputaction_t action); 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). * 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); 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). * Gets the last value of a specific input action (non-fixed timestep).
* *