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 / dbKeyState ( )

Author
Message
Cryptic Dragon
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location:
Posted: 28th Jun 2009 05:59
This is the following information given in the Dark GDK information area...

dbKeyState
This command will return a value of one if the key specified by the scancode is pressed, otherwise zero will be returned. The scancode value is the raw value assigned to the key of the keyboard device and very often is ordered sequentially from the top left of the keyboard to the bottom right.

Syntax
int dbKeyState ( int iScanCode )

Related Information
INPUT Commands Menu
Index

...which is easily understood.bWhat I am used to is the decimal value of the key relative to the binary or hex sequence. Such items are as the number 9 is 39 in Hex., 00111001 in Bin., and 57 in Dec.

I was wondering where in the information is the actual integer value used for the dbKeyState for each key on a standard keyboard???

Thanks in advance!

js

You know for a fact that you have reached the edge when you can absolutely see sound!
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 28th Jun 2009 06:16
If you include "dinput.h", there are most of the keys defined for you. For example, the 'a' key would be DIK_A, 'w' would be DIK_W, the space bar would be DIK_SPACE (not sure), and the right control key might be DIK_RCONTROL.

Here's the full list.



Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Cryptic Dragon
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location:
Posted: 28th Jun 2009 08:07
Thanks Bran flakes91093. I am copying and pasting your little Code Snippet for later use when I may need other key board Hex values.

#define DIK_SPACE 0x39

3 * 16 + 9 = 57. So for the digital value relative to Dark GDK for the space bar is 57.

This makes better sense for me now. In the past I almost always normally develop my software at the binary level with an interface I created both via C++ and C#.

Thanks again for the Snippet.

CrypticDragon

You know for a fact that you have reached the edge when you can absolutely see sound!

Login to post a reply

Server time is: 2024-10-01 05:47:44
Your offset time is: 2024-10-01 05:47:44