PocketMatrix forums

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

Am i a fool or just stupid.?

How do i get to use the buttons on an Ipaq.
.
In my code i call one of the button funcs from easyCE and nothing happens .. ive just tried to show a message box and whenever i try a button it locks up
...Am i stupid..really stupid or getting it all wrong
..can someone shed the light on where im going wrong

while (!clicked())
{

if(pressed){

//whatever

}
update( false );
}
I think this should work:

Code:
// Main loop: Exit when clicked
while (!clicked())
{
// Check for a button press
if(pressed())
{
// Whatever
}
// Update the physical display
update();

}


It may also depend what you are doing when the button is pressed. I may be wrong, but I think if you try to do a call to the MessageBox API function, it may display the box behind the GAPI window so you'd never see it.

Pam

P.S. Don't forget to use the code tag when you post code!
Lewil · 19 Apr 2002, 15:12 UTC — hmmm
i think

Code:

if ( pressed() )


is better than

Code:

if ( pressed )


hmmm ?[/quote]
Thanks Pam.
That seems not to work..

basically i have an object that when i hit a button then the object should move, so any key press is ok but it dont work.

thanks again.
Try posting your code, or at least the piece not working and we'll have a look.


Pam
Thanks Pam
Basically im a total buffoon as this code does the trick.

I had a chinese banquet for lunch and it seems to have affected my mind

thanks for your help and time


Code:

if(buttonleft())
{
if((view_angle.ang_z += 5)>360)
view_angle.ang_z = 0;

}


kinda obvious really
mybe better that way
(otherways you loose all degrees above 360):

Code:

if(buttonleft())
{
if((view_angle.ang_z += 5)>360)
view_angle.ang_z -= 360;

}
That's the textbook case to use modulos:
Code:

if(buttonleft())
view_angle.ang_z=(view_angle.ang_z+5)%360;


Dan East
BurningSheep · 27 Apr 2002, 15:22 UTC
yeah, I was going to post that as well, but you can only use modulo on integers. And a division costs more time to perform than an if and a subtraction. So when you're sure the angle won't exceed 720 you might be better off using the subtraction.