PocketMatrix forums

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

Getting input in PocketPC

how can I tell if a button is pressed?
and what button was it?
if I use GAPI, so I need to use the messege queue(WM_KEYDOWN), and it's not good for me...
is there another way doing this?
What's wrong with processing the messages and simply setting a flag in an array?

Code:

char g_keystates[256];

...
case WM_KEYDOWN:
wParam &= 0xff;
g_keystates[wParam]=1;
break;

case WM_KEYUP:
wParam &= 0xff;
g_keystates[wParam]=0;
break;


Then in your game code just check the state of the key in your array:
Code:

if (g_keystates[32])
//Space bar is down
Jump();


You can also look into GetKeyState, although I've never used it with GAPI.

The advantage with keeping your own array is it makes your code more portable. Your actual game code relies only on your array of key states, so all the platform-specific code can be in one place and not spread out throughout your code.

Dan East
where I can get the key list for each button on the PocketPC?
See GXKeyList.

Dan East
Is there any other way doing this without using the WindowProc function?
because I cant make it work (pass the WPARAM to a class, very complicated thing...)
Did you look at GetKeyState?

Dan East
Dan East wrote:Did you look at GetKeyState?

Dan East

yeah it dosent work...
I think it's because I called GXOpenInput(),but if I wont so when I click on one of the buttons so the program will exit...