# Problems with SDL\_GetKeyState

**URL:** <https://discourse.libsdl.org/t/problems-with-sdl-getkeystate/10790>\
**Category:** SDL Development\
**Created:** [May 19, 2004, 8:40pm UTC](https://discourse.libsdl.org/t/problems-with-sdl-getkeystate/10790 "2004-05-19T20:40:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hendrik](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/h/839c29/32.png) [@Hendrik](https://discourse.libsdl.org/u/Hendrik)\
**Post date:** [May 19, 2004, 8:40pm UTC](https://discourse.libsdl.org/t/problems-with-sdl-getkeystate/10790/1 "2004-05-19T20:40:02Z")

</div>

hi all,  
i hope someone can help me with a problem with SDL\_GetKeyState.  
I use a small routine like this:  
…  
keys = SDL\_GetKeyState(NULL);  
if(keys[SDLK\_SPACE])  
{  
if(!jump)  
{  
jump=true;  
jump\_idx = 0;  
}  
}  
if(keys[SDLK\_UP])  
{  
map\_yoff-=inc;  
}  
if(keys[SDLK\_DOWN])  
{  
map\_yoff+=inc;  
}  
if(keys[SDLK\_RIGHT])  
{  
map\_xoff+=inc;  
}  
if(keys[SDLK\_LEFT])  
{  
map\_xoff-=inc;  
}  
…

UP,DOWN,RIGHT,LEFT,SPACE and all Combinations are recognized - except  
UP+LEFT+SPACE - it doesn’t seem to work. I can’t imagine what’s the different  
with this combination - is this a sdl problem, or are there better  
ways to check key-combinations ?

system is win2k + SDL-1.2.7

thanks in advance,  
–hendrik

---

<div class="post-metadata">

**Author:** ![atrix2](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/a9a28c/32.png) [@atrix2](https://discourse.libsdl.org/u/atrix2)\
**Post date:** [May 19, 2004, 8:58pm UTC](https://discourse.libsdl.org/t/problems-with-sdl-getkeystate/10790/2 "2004-05-19T20:58:31Z")

</div>

it’s might be a hardware limitation actualy, check this out:

[Keyboards Are Evil.](http://www.sjbaker.org/steve/omniv/keyboards_are_evil.html)\> ----- Original Message -----

> From: [hendrik.huettemann@t-online.de](mailto:hendrik.huettemann@t-online.de) (Hendrik)  
> To:   
> Sent: Wednesday, May 19, 2004 1:40 PM  
> Subject: [SDL] problems with SDL\_GetKeyState
> 
> > hi all,  
> > i hope someone can help me with a problem with SDL\_GetKeyState.  
> > I use a small routine like this:  
> > …  
> > keys = SDL\_GetKeyState(NULL);  
> > if(keys[SDLK\_SPACE])  
> > {  
> > if(!jump)  
> > {  
> > jump=true;  
> > jump\_idx = 0;  
> > }  
> > }  
> > if(keys[SDLK\_UP])  
> > {  
> > map\_yoff-=inc;  
> > }  
> > if(keys[SDLK\_DOWN])  
> > {  
> > map\_yoff+=inc;  
> > }  
> > if(keys[SDLK\_RIGHT])  
> > {  
> > map\_xoff+=inc;  
> > }  
> > if(keys[SDLK\_LEFT])  
> > {  
> > map\_xoff-=inc;  
> > }  
> > …
> > 
> > UP,DOWN,RIGHT,LEFT,SPACE and all Combinations are recognized - except  
> > UP+LEFT+SPACE - it doesn’t seem to work. I can’t imagine what’s the  
> > different  
> > with this combination - is this a sdl problem, or are there better  
> > ways to check key-combinations ?
> > 
> > system is win2k + SDL-1.2.7
> > 
> > thanks in advance,  
> > –hendrik
> > 
> > * * *
> > 
> > SDL mailing list  
> > SDL at [libsdl.org](http://libsdl.org)  
> > [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)
