esc detector wont run -- 'out of scope' |
capehill
|
If this is SDL2, then check: https://wiki.libsdl.org/SDL_Keysym
Your type should probably be SDL_Keycode. |
|||||||||||
|
speartip
|
Thanks! That fixed it so it will compile. No more errors. The code still doesn't do what it is supposed to: abort when you press esc. I flagged it up. It never gets passed flag 1.
|
|||||||||||||
|
speartip
|
Sorry: forgot to post output:
flag 1 flag 1 flag 1 flag 1 flag 1 flag 1 flag 1 .....ad infinitum gameRunning is never set to false |
|||||||||||
|
capehill
|
Do you have a window open? Does Control-C work?
|
|||||||||||
|
DLudwig
|
I'd like to second the above. Many platforms need a window open, before input can be received. Using either SDL_CreateWindowAndRenderer, or just SDL_CreateWindow, once beforehand at app init, may be sufficient to fix this. -- David L. |
|||||||||||||
|
speartip
|
Thanks every one. In addition to having a window in context I added this small code:
|
|||||||||||||
|
capehill
|
Here is something that I use in a puzzle game. First I poll for events which triggers the event pump, and then I check the keyboard state. This happens at 60 Hz rate, each time game logic is ran.
|
|||||||||||||
|