Nintendo DS Lite >> C/C++

Input (Touch)


參考資訊:
1. libnds doc

說明:

API
void touchRead(touchPosition *data)

main.c

#include <nds.h>
#include <stdio.h>
 
int main(void)
{
    touchPosition cur_tp = {0};
    touchPosition pre_tp = {0};
 
    consoleDemoInit();
    while (1) {
        scanKeys();
        touchRead(&cur_tp);
        if ((cur_tp.px != pre_tp.px) || (cur_tp.py != pre_tp.py)) {
            pre_tp.px = cur_tp.px;
            pre_tp.py = cur_tp.py;

            iprintf("\033[2J");
            printf("tp.x:%d, tp.y:%d\n", cur_tp.px, cur_tp.py);
        }
    }
    return 0;
}

完成


返回上一頁