// player control of box
const Uint8* currentKeyStates = SDL_GetKeyboardState(NULL);
if (currentKeyStates[SDL_SCANCODE_RIGHT]) {
}
if (currentKeyStates[SDL_SCANCODE_LEFT]) {
}
if (currentKeyStates[SDL_SCANCODE_UP]) {
}
if (currentKeyStates[SDL_SCANCODE_DOWN]) {
}
I have read that the basic game loop is input, simulate, render. However in this example I am using keypresses to immediately move an object.
If I wanted to do that, I am not sure how to pass all possible key combinations into a function. If it was only one key at a time, then I would write:
void input_function(specific_key) {
}
Does it make sense separate the movement part from the input part in this case?