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:
2016-11-25 18:03:25 +11:00
parent d878cca8ab
commit 5bb7fa8c13
8 changed files with 173 additions and 130 deletions
+2 -1
View File
@@ -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';
}