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

DARKGuy . dark.guy.2008 at gmail.com
Thu Sep 14 10:58:24 PDT 2006


Whoops! my bad then :( I think the only way is using IFs :P

On 9/14/06, Peter Mulholland <darkmatter at freeuk.com> wrote:
>
> 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
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060914/b8e9afaa/attachment-0008.htm>


More information about the SDL mailing list