If you don't want the code to execute multiple times for as long as you hold down the keys you should also check that the repeat value of the event is false.
1 2 3 4
if (!event.repeat)
{
// This is not a repeated event.
}
error: 'Uint8' does not name a type
error: 'state' was not declared in this scope
error: 'SDL_SCANCODE_LCTRL' was not declared in this scope
error: 'SDL_SCANCODE_RCTRL' was not declared in this scope
error: 'SDL_SCANCODE_A' was not declared in this scope -> may it is because i cant install SDL library please help post -> http://www.cplusplus.com/forum/windows/182070/
If you still can not install SDL properly, then you had better give up learning it for the time being and switch to a different graphics library. There is no sense in learning something that you are unable to use or practice.
const Uint8 *state = SDL_GetKeyboardState(NULL);
if (state[SDL_SCANCODE_RETURN]) {
printf("<RETURN> is pressed.\n");
}
if (state[SDL_SCANCODE_RIGHT] && state[SDL_SCANCODE_UP]) {
printf("Right and Up Keys Pressed.\n");
}
See the first line? There is an example of declaring a variable called state