I'm new to game dev,and I just trying to create my first game,a simple pong game.But i can't handle the keyboard input.
This is what i got :
const Uint8 * keystates = SDL_GetKeyboardState(NULL); SDL_PumpEvents(); if (_keystates[SDLK_s]) std::cout << "Down is pressed";
But if i run it and press 's',nothing ever happens.
if (_keystates[SDLK_RETURN]) std::cout << "Return is pressed";
For this one is working just when i press 'j'... Yeah,right?
And more,if I add this line :
if (_keystates[SDLK_DOWN]) std::cout << "Bla bla..";
My game crashes,what do you think is the problem?Thank you.