I'm following day 017 successfully up until Casey puts the assert check for endedDown
. The assert
check seems to fail and crash the program once any
arrow key is pressed since Win32ProcessKeyboardMessages()
appears to be called twice for a single keystroke. That resets the endedDown
comparison to a equal and incorrect state, as evidenced by the debug statements. The assertion fails because the states are meant to be unequal in order to preserve, from what I understand, the previous state of the keyboard input.
Please see the attached image (click to enlarge) for what I mean.
I'm sure it's a stupid typo I've made, but I'm just in a rut here. Any help getting to the bottom of this would be much appreciated. I've spent about 2 hours trying to fix this and am stumped since the code is as he types in.
With the assert disabled but all the code before it added, the screen only shifts by 1 pixel even when the down arrow is held down, which I find strange. It's as if the new code isn't being seen.
Update: The good news is that 017-source
compiles perfectly, so it's definitely something wonky in my local code. I'd like to know what's wonky
though, but it could just be something underlying fixed in the later part of the video.