Improve input handling using state flags
Fix reading one shot inputs not working due to prematurely clearing out state data tracking input changes between one frame and another. The transition count used to track this now stores difference between each frame in the input flags. This also solves requiring at the end of the frame to update the transition counts at the end of each update loop.
This commit is contained in:
+2
-1
@@ -56,7 +56,8 @@ INTERNAL void keyCallback(GLFWwindow *window, int key, int scancode, int action,
|
||||
i32 offset = 0;
|
||||
if (key >= 'A' && key <= 'Z')
|
||||
{
|
||||
if (!game->input.keys[keycode_leftShift].endedDown)
|
||||
KeyState *leftShiftKey = &game->input.keys[keycode_leftShift];
|
||||
if (!common_isSet(leftShiftKey->flags, keystateflag_ended_down))
|
||||
offset = 'a' - 'A';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user