[SDL] Re: SDL_ListModes on winCE (GAPI patch)

Dmitry Yakimov support at activekitten.com
Tue Nov 22 13:00:21 PST 2005


if (keys[SDLK_UP])

is the same as:

if (keys[SDLK_UP] != 0)

which is obviously different than:

if (keys[SDLK_UP] == 1)

 Only if that variable was of type boolean your statement would be correct, 
which it isn't (Uint8 == unsigned char).

Cheers,
 Ricardo

Em Terça 01 Novembro 2005 19:36, o ALTAIR - escreveu:
> If (keys[SDLK_UP]== 1)
>
> is the same what:
>
> If (keys[SDLK_UP])
>
> >From: Martin Storsjö <martin at martin.st>
> >Reply-To: "A list for developers using the SDL library.
> >(includesSDL-announce)" <sdl at libsdl.org>
> >To: "A list for developers using the SDL library. (includes
> >SDL-announce)"<sdl at libsdl.org>
> >Subject: Re: [SDL] Strangle problem using keys
> >Date: Tue, 1 Nov 2005 19:08:32 +0200 (EET)
> >
> >On Tue, 1 Nov 2005, ALTAIR - wrote:
> >>if (keys[SDLK_UP]== 1) { move_up(); }
> >>if (keys[SDLK_DOWN]== 1) { move_down(); }
> >>
> >>Is this correct?. I am using SDL-1.2.8 (the stable version when all was
> >>installed). No errors when I compile on my Linux, but the key are not
> >>detected.
> >
> >I'd suggest trying
> >
> >if (keys[SDLK_UP])
> >
> >instead, since it could be any value except zero.
> >
> >// Martin
> >
-- 
Bizarreness is the essence of the exotic




More information about the SDL mailing list