#57389 - Didou - Sat Oct 15, 2005 2:32 pm
Hi,
I wonder about libnds: when is the IPC structure (touchpad touchX and touchY fields) updated ? I though it was by the vblank interrupt...
I experimented a strange effect (not present with the old NDSlib): when I get these position, I always get those of the previous pen hit (so 1 hit shifted in time).
I even tried waiting for vblank before reading : same thing...
-- Didou
I use the following kind of code:
I wonder about libnds: when is the IPC structure (touchpad touchX and touchY fields) updated ? I though it was by the vblank interrupt...
I experimented a strange effect (not present with the old NDSlib): when I get these position, I always get those of the previous pen hit (so 1 hit shifted in time).
I even tried waiting for vblank before reading : same thing...
-- Didou
I use the following kind of code:
Code: |
#define PEN_HIT (~pen_curr & pen_prev) #define PEN_RELEASED (pen_curr & ~pen_prev) static boolean wait () { u16 x, y ; u16 pen_prev = IPC_PEN_DOWN ; u16 pen_curr = IPC_PEN_DOWN ; for (;;) { pen_prev = pen_curr ; pen_curr = (IPC->buttons & IPC_PEN_DOWN) ; if (PEN_HIT) { x = (IPC->touchX - 0x0113) / 14 ; y = (IPC->touchY - 0x00E0) / 19 ; iprintf ("\x1b[0;0H Pen hit at %05d %05d", x, y) ; .... |