PocketMatrix forums

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

Ipaq Calendar and Contact Buttons

Hello
I want to use Ipaq Calendar and Contact Buttons
into my game
the buttonA() and buttonB() work
but the buttonC() and buttonD() are for rec button and pad centre button
how to use Calendar and Contact Buttons? :?
Usually there's a utility for binding what you want for which buttons. I believe you can rebind what the enumerated GAPI inputs are associated to, button wise, but honestly I haven't played around with that much yet. Someone else on here would likely know more.

-Hosed
EasyCE 1.6 (and 1.5 too, I believe) allows you to detect random button presses. When a button is pressed that is not lefrt, right, up, down, A, B, C or D, it can still be detected that way. You can even assign it to one of the listed buttons so that EasyCE will use the new button instead. That's what I did in the Nutcracker. Be careful though; 3800 devices don't seem to like this approach, and newer HP's return two button presses at once for most buttons.
laurnet · 20 Jan 2002, 14:40 UTC — buttons
hello
I tried int lastkey() and the setfunctions
the lastkey function work with every buttons but these Calendar and contact buttons(also,they work out of easyce),
when I press them the lastkey() won't recognize anything,as if I didn't press any buttons.
but it work for every other buttons .
strange?
Yes, that's strange. Are you using an 3800 model?
laurnet · 21 Jan 2002, 12:30 UTC — strange
I use ipaq3630,
I know my ipaq is 'broken' because when I press these at the same time with the centre pad button ,I get every time a hard reset, :cry:
but the buttons still work,so i don't really know if its my ipaq..
laurnet · 23 Jan 2002, 23:37 UTC — get rid of pause when button is pressed
i get a pause when a button(not the pad) is pressed
but i don't make any pause,if anyone got the time,take a look at my peace of code:

Code:

zerolastkey(); //configure buttons
print("-Tape key for up",10,140,blue);
update();
while(!pressed())
{update();}
setCscan( lastkey() );
print("-Tape key for down",10,160,blue);
update();
while(!pressed())
{update();}
setDscan( lastkey() );
resettimer();while(msecs() < 800)
{} // same for left and right


while ( !clicked()) //make the buttons tests
{
update();
if(buttonA())
{
dir1=1; //direction of the sprite
while ( !pressed())
{
x1=x1-2;
memcpy( buffer, trace, 240 * 320 * 2);
ai(dir1,x1,y1,trace);
player(dir,x,y,trace);
update();
}
FSOUND_PlaySound(FSOUND_FREE,sptr); //play fmod sound
}// same for button B C D... and close the while
...


well you must press the button two time because there is a pause at the first button press,
I think the first part should be something like this:

Code:

int tempkey=0;
zerolastkey(); //configure buttons
print("-Tap key for up",10,140,blue);
update();
while(!(tempkey = lastkey()))
{update();}
setCscan( tempkey );
print("-Tap key for down",10,160,blue);
update();
while(!(tempkey = lastkey()))
{update();}
setDscan( tempkey );


In case the changes aren't immediately obvious, what I changed is to replace the "while(!pressed())"s with "while(!(tempkey = lastkey()))"s. Basically, you can use lastkey as a check for button presses. I believe that if you use lastkey() it will erase the stored value (I think... I don't have the docs (or the source) handy), thus necessitating the tempkey variable. I believe (once again, I haven't been able to test it yet) that the setXscan functions use the last key pressed if the value is zero, and waits if that is also zero.

I hope this isn't too confusing. I'll check when I get home to see if it works.
laurnet · 29 Jan 2002, 21:09 UTC — tempkey
hello
thanks for reply,
I don't understand what value tempkey is equal ?
does it take the lastkey value in :

while(!(tempkey = lastkey()))

it dont seem to work for now ,it won't wait for a pressed key..but it must be what you are talking about,i'll try later
billcow · 29 Jan 2002, 21:42 UTC — Example
I made up a quick example/test of the buttons:
Code:

#include "EasyCE.h"

/*
uncomment the following to use the following keys
Calendar: Button A (0xC1)
Contacts: Button B (0xC2)
Inbox: Button C (0xC3)
iTask: Button D (0xC4)
d-pad center: Button E (0x86)
the arrow keys will stay the same
leave it commented to use the configuration code
*/
//#define PRECONFIG

void main()
{
#ifndef PRECONFIG
zerolastkey(); // erase previous key (so it will always wait)
print("Tap key for C",10,140,0xFFFF); // print message
while(!lastkey()) // loop until any key is pressed (pressed() only checks A,B,C,D,up,down,left and right)
update();
setCscan(lastkey()); // set the scancode for button C (it will be set to the last key pressed
zerolastkey(); // erase that key (so it will wait)
print("Tap key for D",10,160,0xFFFF); // everything from here is the same as for button C
update();
while(!lastkey())
update();
setDscan(lastkey());
#else
setAscan(0xc1);
setBscan(0xc2);
setCscan(0xc3);
setDscan(0xc4);
setEscan(0x86);
#endif

bool done=false;

while (!done)
{
if (buttonup())
clear(0);
if (buttonA())
{
char msg[256];
sprintf(msg, "Button A pressed: %X", getAscan());
centre(msg, 20, 0xFFFF);
}
if (buttonB())
{
char msg[256];
sprintf(msg, "Button B pressed: %X", getBscan());
centre(msg, 30, 0xFFFF);
}
if (buttonC())
{
char msg[256];
sprintf(msg, "Button C pressed: %X", getCscan());
centre(msg, 40, 0xFFFF);
}
if (buttonD())
{
char msg[256];
sprintf(msg, "Button D pressed: %X", getDscan());
centre(msg, 50, 0xFFFF);
}
if (buttondown())
done=true;
resettimer();
update();
}
}

The second half of the "#ifndef" will preset the buttons in (what I consider to be) a more logical layout (it also programs the center of the d-pad to button "E", which is by default unused.

You may want to consider moving this part to the EasyCE source within the check for the H3800 iPAQ (that way everything will work fine for other devices as well)

Feel free to use this code if you want. You don't even have to give me credit unless you really feel the need to.
laurnet · 30 Jan 2002, 13:43 UTC — hey
thanks a lot !!!!,it work now with your code
all buttons work using preconfig ,my little code was bad .
With !lastkey function, and zerolastkey ,it won't make a pause.
:D