Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

press and hold the keys


press and hold the keys

Postby awni » Oct 23, 2005 @ 11:26pm

(sorry for posting twice, I posted the first time without logging in, plz ignore the post from 'Guest')

Greetings.
I'm using PocketPC(2003 and Jam)
When I use KeyDown, I have to repeatedly press the keys. I'd like to press and hold the keys on the PPC and have the application respond.

thank you

awni
awni
pm Member
 
Posts: 3
Joined: Oct 23, 2005 @ 11:10pm
Location: Jordan


Postby Presto » Oct 24, 2005 @ 1:39pm

What you need to do is set a state variable, and check it.

For example, make the following boolean array:
bool bKeyDown[8];

Add add this in KeyDown:
bKeyDown[KEY_RIGHT] = true;
// or LEFT, UP, DOWN, A, B, C, etc

And this in KeyUp:
bKeyDown[KEY_RIGHT] = false;

Then you can check the bKeyDown array.
User avatar
Presto
pm Insider
 
Posts: 763
Joined: Jan 20, 2003 @ 5:51am
Location: Kalesian Archipelago


Postby awni » Oct 24, 2005 @ 7:53pm

that's the idea i'm using right now, i used variables instead of an array, but i get the same result. I was looking for an alternative. Something that will continously call a function while a key is down. If no such method exists, that's ok, i'll use your array approach...

thank you

awni
awni
pm Member
 
Posts: 3
Joined: Oct 23, 2005 @ 11:10pm
Location: Jordan


Postby ppcStudios » Oct 25, 2005 @ 12:28pm

Presto's suggestion is the accepted practice. You shouldn't do any heavy processing within KeyUp/KeyDown as you want these to return as quickly as possible. Set your flags in these methods and process them (ie call your functions) within ProcessNextFrame.
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 awni » Oct 25, 2005 @ 7:01pm

thanks
I'll be doing that...and I'll be posting a second question...

awni
awni
pm Member
 
Posts: 3
Joined: Oct 23, 2005 @ 11:10pm
Location: Jordan


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