This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Possibly silly question about keylist...


Possibly silly question about keylist...

Postby fzammetti » Feb 20, 2004 @ 6:12am

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby Layre5150 » Feb 20, 2004 @ 1:45pm

If you're trying to do what I think you are (which would be to check if a certain key/button is pressed outside of the input events) you could try using GetAsyncKeyState( vk_code ). Using the Hiword of the return value will give you your answer as to what is being pressed (or released).

If you needed a valid GDKEYLIST structure outside of the event handlers, my guess is that you would have to manually fill it in yourself and with using GetAsyncKeyState.

However, you may be doing something else other than what I think you're doing - in which case my reply may not even relevant.
Layre5150
pm Member
 
Posts: 21
Joined: Feb 13, 2004 @ 5:17pm


Postby fzammetti » Feb 20, 2004 @ 2:57pm

That was a good guess Layre5150! Actually though, I was writing a key mapping screen in my game. What I've done is I have six DWORD variables in my game class, vkUp, vkDown, vkLeft, vkRight, vmCommand and vkAction. In my key mapping button event handler, I'm basically doing:

// If we're assigning the vkCommand button...
if (dwKey == keylist.vkA) { vkCommand = keylist.vkA; }
// ... and so on

So, what I wanted to do was have default values in those six variables that echo what's in keylist, since chances are they won't even need to be remapped most of the time anyway. Doing it in InitInstance() seemed to make the most sense.

I'd still like to know the answer to my question, but it's actually no longer relevant since something dawned on me in the shower (where most of my good ideas hit me!)... instead of checking for the various members of keylist in my handler and assigning as appropriate, all I really need to do is:

// If we're assigning the vkCommand button...
vkCommand = dwKey;
// If we're assigning the vkAction button...
vkAction = dwKey;
// ... and so on

That way, I can handle buttons that aren't registered in keylist too (I assume they would still come through Johan? I'm thinking maybe the fourth button on an Axim, which I would guess would be vkD if it was a member of the structure, but since it isn't, I'd still get some values passed to KeyUp, right?).


EDIT: Please ignore the part where I say this is no longer relevant! It still may be, so I still need an answer. I'm thinking about the whole "phantom" button press thing... I presume that the first value passed in would NOT be one of the values in keylist, therefore it's probably correct to still check against what's in the structure, in which case I'll still need to be able to set default. I'm probably just confusing things here, so ignore it all and just focus on the underlying question: How can I get the value of the vkA member in keylist (for example), outside of a KeyDown handler method, preferably in InitInstance()?
...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby mlepage » Feb 20, 2004 @ 4:48pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby fzammetti » Feb 20, 2004 @ 4:59pm

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby Johan » Feb 21, 2004 @ 9:04am

Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
[]
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby fzammetti » Feb 21, 2004 @ 2:33pm

Ok, good. Johan, what about my original question? Is it possible to get at the values in keylist outside an event handler?
...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby Johan » Feb 21, 2004 @ 6:06pm

Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
[]
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby ppcStudios » Feb 21, 2004 @ 6:35pm

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby fzammetti » Feb 21, 2004 @ 11:37pm

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby ppcStudios » Feb 22, 2004 @ 12:22am

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby fzammetti » Feb 22, 2004 @ 2:14am

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby mlepage » Feb 22, 2004 @ 2:32am

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby ppcStudios » Feb 22, 2004 @ 2:53am

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby fzammetti » Feb 22, 2004 @ 3:31am

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Next

Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron