PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

some questions with GDKEYLIST structure

So there is this GDKEYLIST that holds what key was pressed and u test in the KeyDown agasint dwKey or what not. Fine and dandy. The thing is my pda for instance has 4 buttons, a nav button and a push in nav button that acts as enter on it, so that would be something like:
vkUP
vkDOWN
vkLEFT
vkRIGHT
vkA
vkB
vkC
vkD
vkStart

It seems on my machine (the dell axim) I can get up down left right a b c and then vk start is actually the 4th button (what id suspect to be vkD, i realize according to docs there is no vkD).

So how do i handle other buttons, like the pushing inof nav bar? or can I only handle whats alloted by the GDKEYLIST structure?

-Shane
I was wondering about this too. My iPAQ has an extra button (record) that doesn't seem to appear in this structure. And it has four buttons, but there's only three (A B C) in the structure.
Im pretty sure you cant get those extra keys by default, but you should be able to have the user set them.

Instead of doing this:
Code:

if(dwKey==keylist.vkUp)
{
//Do some stuff
}


Id do this:
Code:

DWORD dwUp=keylist.vkUp;
//Possibly some function inbetween to
//set dwUp to a different value
if(dwKey==dwUp)
{
//Do some stuff
}


That way you could at some point set dwUp to a different key than just the preset up button that the Gapi gives you which I believe should let you play with all the buttons on your device.
InexorableTash · 01 Sep 2003, 20:15 UTC
Another cool and/or crazy idea: a GapiInput package (another analog with DirectInput) that handles more than just exposing the GAPI keywords. For example, it could have profiles for all known devices with a good set of default mappings, and work with standard mapping structures.

Additionally, having standard command profiles for game types (e.g. platform, RTS, 3D space, FPS, etc) would make it easier both to develop and play games. (If that doesn't make sense, look at the DirectInput docs. As an example, when in landscape mode, the Record button on the old iPaqs makes a great fire button, and it's a shame to not take advantage of that on the iPaq platform, but other platforms shouldn't suffer.)

As an added bonus, on-screen controls (d-pads, fire buttons, etc) would build right into this, so that a game could easily swap in different controller setups with no change in the underlying code.

I have part of such a thing in my hobby game; different modules register mappings in a DirectInput-esque way. Here's how the dialog module asks for events:

Code:

//-------------------------------
GIINPUTMAPPING c_rgIMDialog[] =
//-------------------------------
{
{ GIBUTTON_SELECT, GIID_BUTTON_START },
{ GIBUTTON_SELECT, GIID_BUTTON_A },
{ GIBUTTON_CANCEL, GIID_BUTTON_B },

{ GIAXIS_LEFTRIGHT, GIID_AXIS_DPADHORZ },
{ GIAXIS_UPDOWN, GIID_AXIS_DPADVERT },

{ GIMOUSE_MOVE, GIID_MOUSE_MOVE },
{ GIMOUSE_DOWN, GIID_MOUSE_DOWN },
};


The right hand side represent the generic events generated by the input module. The right hand side is the events that the dialog module will see.

You should also be able to query for the state of any input and (optionally) get events on state changes if you don't want to rewrite your state-change detection logic for every game (or module).
Yeh and "action mapper" would be nice :)