Edit: Running Windows 10, Code::Blocks, SDL2. If you need any other information please let me know.
I have a strange problem with my program where it will not accept letters for SDL_KEYDOWN. Here is the code snippet and I will explain why it is so strange:
case SDL_KEYDOWN: switch(e.key.keysym.sym) { case SDLK_ESCAPE: return true; break; case SDLK_UP: current_keypress = 0; break; case SDLK_DOWN: current_keypress = 1; break; case SDLK_LEFT: current_keypress = 2; break; case SDLK_RIGHT: current_keypress = 3; break; case SDLK_a: current_keypress = 4; break; case SDLK_z: current_keypress = 5; break; } break;
The letters simply won’t activate the case. Here’s where the strange part comes in. I have used letters on past programs and they work fine. Also, if I change SDLK_a or SDLK_z to another value, like SDLK_F1, then they work fine. I was suspicious that e.key.keysym.sym was producing the wrong value, but it is producing the correct value for both SDLK_a and SDLK_z. In addition, I have tried using other letters and they also fail. How could e.key.keysym.sym == SDLK_a, and yet it not activate the case?