fixed timing of memcpy of keys to keysLast

This in turn fixes GetKeyDown() and GetKeyUp() as the input manager now knows changes of keys between the last frame and current frame.
This commit is contained in:
mushgunAX 2022-10-13 23:03:30 +08:00
parent 28ec02afee
commit 288f58c978
1 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,10 @@ namespace SHADE
void SHInputManager::UpdateInput(double dt) noexcept
{
//Keyboard and Mouse Buttons////////////////////////////////////////////////
//Keyboard and Mouse Buttons////////////////////////////////////////////////
//Write to lastKeys
memcpy(keysLast, keys, sizeof(keys));
//Poll
unsigned char keyboardState[MAX_KEYS];
//if (GetKeyboardState(keyboardState) == false) return;
@ -96,9 +99,6 @@ namespace SHADE
}
}
//Write to lastKeys
memcpy(keysLast, keys, sizeof(keys));
//Mouse Positioning/////////////////////////////////////
//https://stackoverflow.com/a/6423739