[SDL] Keyboard movement: Can't use two keys at once?

Peter Mulholland darkmatter at freeuk.com
Thu Sep 14 10:52:41 PDT 2006


Hello DARKGuy,

Thursday, September 14, 2006, 5:58:31 PM, you wrote:

> I think it would be something like...

> Uint8 *keystate = NULL;
> switch (keystate = SDL_GetKeyState(NULL)){
>     case SDLK_UP:
>         move_up=true;
>         break;
>     case SDLK_DOWN:
>         move_down=true;
>         break;
> }

> I'm not at home, but that should do it I guess.

No - the return value from SDL_GetKeyState() is a pointer. This would
not do what you want.

You cannot check an array using switch/case.

-- 
Best regards,
 Peter                            mailto:darkmatter at freeuk.com





More information about the SDL mailing list