PocketMatrix forums

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

Holding down buttons?

I am new to pocket pc programming and I don't know how to check if buttons are held down, for example holding left will make a spaceship turn left.

In my game/demo have the following code for detecting buttons

void game::ButtonDown(int button) {

if(button == m_keys.vkUp)
{
rikt =1;
rx = 0;
ry = -1;
}
if(button == m_keys.vkDown)
{
rikt = 3;
}
and so on....
I want to have like this instead:
if(button held down)
{
angle = angle +1;
}
probably in the main loop, since void game::ButtonDown(int button) is on called once a button is press.
Check this thread:
http://www.pocketmatrix.com/forums/view ... hp?t=22413

In PocketFrog, it's basically the same thing. When ButtonDown() or ButtonUp() is called, change the state variable, and check the variable during GameLoop(). If you want to use just one variable for all the button data, you can assign each button a value like 1,2,4,8,16,32,64,128 and add/subtract that amount for button presses/releases, but I generally like to use booleans for it.

-John