Key modifier

Hi, i’m trying to use the key modifier, but i can’t. I’m doing :

Uint8 *teclas = SDL_GetKeyState(NULL);

if (teclas[SDLK_LEFT] == SDL_PRESSED)
{
if ((SDL_GetModState() & KMOD_ALT) == KMOD_ALT)
player->SlideLeft();
else
player->TurnLeft();
}

but the SlideLeft procedure never is called, what i’m doing wrong???

i’m using SDL 1.1.6 on SuSE 7.0 , XFree 3.3.6

Thx a lot !!–
±-----------------------------±-----------------------+
| Ricardo Markiewicz | El software es como el |
±-----------------------------+ sexo… Si es gratis |
| Linux Inside! - S.u.S.E. 6.4 | Mejor !!! |
±-----------------------------±-----------------------+

Hi, i’m trying to use the key modifier, but i can’t. I’m doing :

Uint8 *teclas = SDL_GetKeyState(NULL);

if (teclas[SDLK_LEFT] == SDL_PRESSED)
{
if ((SDL_GetModState() & KMOD_ALT) == KMOD_ALT)
player->SlideLeft();
else
player->TurnLeft();
}

but the SlideLeft procedure never is called, what i’m doing wrong???

Try:
if ((SDL_GetModState() & KMOD_ALT) != 0)

The KMOD_ALT mask consists of the left alt and right alt masks together,
and very rarely are both right and left alt pressed at the same time. :slight_smile:

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam Lantinga wrote:

Hi, i’m trying to use the key modifier, but i can’t. I’m doing :

Uint8 *teclas = SDL_GetKeyState(NULL);

if (teclas[SDLK_LEFT] == SDL_PRESSED)
{
if ((SDL_GetModState() & KMOD_ALT) == KMOD_ALT)
player->SlideLeft();
else
player->TurnLeft();
}

but the SlideLeft procedure never is called, what i’m doing wrong???

Try:
if ((SDL_GetModState() & KMOD_ALT) != 0)

I tried that, but (SDL_GetModState() & KMOD_ALT) is alway 0 … can it
be a bug?? , or is my kerboard configuration???> The KMOD_ALT mask consists of the left alt and right alt masks together,

and very rarely are both right and left alt pressed at the same time. :slight_smile:

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software


±-----------------------------±-----------------------+
| Ricardo Markiewicz | El software es como el |
±-----------------------------+ sexo… Si es gratis |
| Linux Inside! - S.u.S.E. 6.4 | Mejos !!! |
±-----------------------------±-----------------------+

Sam Lantinga wrote:

Hi, i’m trying to use the key modifier, but i can’t. I’m doing :

Uint8 *teclas = SDL_GetKeyState(NULL);

if (teclas[SDLK_LEFT] == SDL_PRESSED)
{
if ((SDL_GetModState() & KMOD_ALT) == KMOD_ALT)
player->SlideLeft();
else
player->TurnLeft();
}

but the SlideLeft procedure never is called, what i’m doing wrong???

Try:
if ((SDL_GetModState() & KMOD_ALT) != 0)

I tried that, but (SDL_GetModState() & KMOD_ALT) is alway 0 … can it
be a bug?? , or is my kerboard configuration???

Are you updating the keyboard state with SDL_PumpEvents() or another event
query function?

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software