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 am searching in some games of libsdl.org and in all cases, no errors when
compiling but the keys are not detected?.
Not run, again. Compile without errors but the keys are not detected… :?>From: Brian Barrett <brian.ripoff at gmail.com>
Reply-To: “A list for developers using the SDL library.
(includesSDL-announce)”
To: "A list for developers using the SDL library. (includes
SDL-announce)"
Subject: Re: [SDL] Strangle problem using keys
Date: Tue, 1 Nov 2005 11:18:04 +0000
do you use SDL_PumpEvents() before you GetKeyState.
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 am using a Linux.>From: Brian Barrett <brian.ripoff at gmail.com>
Reply-To: “A list for developers using the SDL library.
(includesSDL-announce)”
To: "A list for developers using the SDL library. (includes
SDL-announce)"
Subject: Re: [SDL] Strangle problem using keys
Date: Tue, 1 Nov 2005 16:41:42 +0000
you may also need to use SDL_PollEvents() to clear the event queue, i
think.
otherwise ( in windows anyway ) the program becomes unresponsive
Reply-To: “A list for developers using the SDL library.
(includesSDL-announce)”
To: "A list for developers using the SDL library. (includes
SDL-announce)"
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.
It’s not the same if keys[SDLK_UP] is 2 or any other number besides 1 and 0> ----- Original Message -----
From: altairdiv@hotmail.com (ALTAIR -)
To:
Sent: Tuesday, November 01, 2005 11:36 AM
Subject: Re: [SDL] Strangle problem using keys
If (keys[SDLK_UP]== 1)
is the same what:
If (keys[SDLK_UP])
From: Martin Storsj?
Reply-To: “A list for developers using the SDL library.
(includesSDL-announce)”
To: "A list for developers using the SDL library. (includes
SDL-announce)"
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.
No, it’s not the same. The first statement is true if and only if
(keys[SDLK_UP]) is exactly 1. The second statement is true as long as
(keys[SDLK_UP]) evaluates to any non-zero value.
For the cases of 0 and 1 they are equivalent, but if (keys[SDLK_UP])
is 2 or more, or any negative number, or any float value (I don’t
think it’s a float variable but the point is worth making here), then
the statement will still evaluate to true.
If you’re using the actual value of (keys[SDLK_UP]) in a calculation
or control statement somewhere and thus always expect (or require) it
to be 1 or 0, the first is okay. If you only care about true or false,
use the second form.
Only if that variable was of type boolean your statement would be correct,
which it isn’t (Uint8 == unsigned char).
Cheers,
RicardoEm 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?
Reply-To: “A list for developers using the SDL library.
(includesSDL-announce)”
To: "A list for developers using the SDL library. (includes
SDL-announce)"
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.