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 / keyboard question

Author
Message
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 7th Jul 2005 04:01
anyone know a trick for getting the scancodes of ALL currently pressed characters?

using the sdk functions of course
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 7th Jul 2005 04:42
You would have to use the keystate command, and check each key that could be pressed.

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jul 2005 21:56
Alternatively, don't use the DBPro functions at all. Use the windows GetKeyboardState function instead - it will provide a snapshot of all keys currently pressed, including the 'state' keys (Ctrl, Shift etc)

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 8th Jul 2005 04:29
hmm yea i might have to

check this out

int getInput() {
int kmap = 0;
//keymap.map is an array containing the scan codes of keys to look for
for (int i=0; i<KEYMAP_SIZE; i++)
if (dbKeyState(keymap.map[i]))
kmap |= KEYMASK[i];

return kmap;
}

only returns the first couple of keys pressed
it could be because of an inherent logic flaw i havent noticed but the logic is straightforward and the masks are all unique.

loop through keys that are mapped to actions
for each key
if the key is pressed, add the corresponding mask to the flag

return the flag

Login to post a reply

Server time is: 2024-04-20 05:46:28
Your offset time is: 2024-04-20 05:46:28