Day 6, 42:30 - Casey starts coding the keyboard input.
From what I remember, while you hold the key down there is no repetition of the button press register.
Yep, that's correct.
The trick is to assign the thing you want to do to IsDown only. Well, if it suits your need of course. In my case, I wanted to call a procedure each time I hit arrow up or down.
I skimmed through your source and I'd try this: you went for a smart thing and you pass the IsDown as a parameter to your custom function. Why not do the simpler, basically braindead-easy thing and not change this
| else if(VKCode == VK_LEFT)
{
Win32ProcessKeyboardMessage(&KeyboardController->ActionLeft, IsDown);
}
|
to this?
| else if(VKCode == VK_LEFT)
{
if(IsDown)
{
Win32ProcessKeyboardMessage(&KeyboardController->ActionLeft);
}
}
|
You'd have to change the Win32ProcessKeyboardMessage, but seems to me it'd be worth it.
Or maybe you just mostly copy-pasted Casey's code without going over it. I've done that too many times to not know how freaking deadly a practice this is. Guess now you do too :/