Calculator Community > Calculator C
[Ndless] Multi-arrow keys detection problem
Matrefeytontias:
Hola,
So that one is a first for me. I have one program, and nspire_emu only detects multi-arrow-keys presses if it's emulating a non-CX Nspire. If it's emulating a CX one, the last pressed key overwrites the preceding one (like, if I hold right then press up, it'll only understand up).
At first I thought that was only nspire_emu, but testing on real HW from a TI-Planet member (I only have a Nspire CAS, on which it worked well) told me that that wasn't nspire_emu.
So I finally thought that was because of the touchpad (again, some may say). That's what I currently have :
--- Code: ---typedef int KeyEvent; // because cleanliness
inline KeyEvent getk(void)
{
return (((isKeyPressed(KEY_NSPIRE_UP) << 1) + isKeyPressed(KEY_NSPIRE_RIGHT) << 1) + isKeyPressed(KEY_NSPIRE_LEFT) << 1) + isKeyPressed(KEY_NSPIRE_DOWN);
}
--- End code ---
I wrote a small debug wrapper for you to test if you wish :
--- Code: ---typedef int KeyEvent;
KeyEvent getk(void)
{
int i;
KeyEvent k;
while(!isKeyPressed(KEY_NSPIRE_ENTER))
{
k = (((isKeyPressed(KEY_NSPIRE_UP) << 1) + isKeyPressed(KEY_NSPIRE_RIGHT) << 1) + isKeyPressed(KEY_NSPIRE_LEFT) << 1) + isKeyPressed(KEY_NSPIRE_DOWN);
for(i = 3; i >= 0; i--)
printf("%d", (k >> i) & 1);
printf("\n");
SDL_Delay(1000);
}
return k;
}
--- End code ---
Look at the console while you press keys ; [enter] to quit.
Any idea ?
Streetwalrus:
Does it also not work on touchpad monochrome calcs ?
Also since the touchpad isn't multi touch you can't detect two arrows, but you can still detect diagonals.
Matrefeytontias:
Well I guess it won't work although I can't really test, I'm only left with a TI-Nspire CAS clickpad and a TI-Nspire CX CAS (thus touchpad) ROM, and switching keyboards within nspire_emu will make arrow keys non-working within the emu.
I also tried reading diagonals with KEY_NSPIRE_LEFTUP and such, but that didn't work either.
Streetwalrus:
IIRC the clickpad calcs are compatible with touchpad keyboards though. :/
Matrefeytontias:
Yeah that's what I thought, so it's really weird ; morever I never had this problem before switching to Ndless 3.1 r914 (my CAS prototype must stay with OS 3.1).
Navigation
[0] Message Index
[#] Next page
Go to full version