Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Question about dbKeyState()

Author
Message
Orient
16
Years of Service
User Offline
Joined: 2nd Aug 2008
Location:
Posted: 8th Aug 2008 19:40
Hi, I'm attempting to use the dbKeyState(int) command in a coditional statement. For some reason, I can't get it to work, and I'm wondering if maybe DarkGDK uses something other than the ASCII value of a key?

So for example, my code looks something like this -

if(dbKeyState(49)){
player.doWhatever();
}

49, I believe, is the ASCII value of the 1 key.. anyone know anything?

Thanks.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 8th Aug 2008 19:55 Edited at: 8th Aug 2008 19:56
As far as I know, 49 is the 1 key. What you can do to check this out is make a program that reports what key is being pressed.



Something like that.


My site, for various stuff that I make.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 8th Aug 2008 21:09
There's a difference between a scan code and an ASCII code. The scan code tells you which physical key was pressed. You can press the 'A' key and get the same scan code back regardless of whether you're shooting for shifted or unshifted state.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 9th Aug 2008 04:20
That's what I assumed he was looking for.


My site, for various stuff that I make.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 9th Aug 2008 13:07
I found the key number codes on this page work for me
http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlkeycodes.html

Login to post a reply

Server time is: 2024-09-30 03:22:58
Your offset time is: 2024-09-30 03:22:58