Nintendo 3DS >> C/C++

Input (Touch)


參考資訊:
1. libctru doc
2. 3ds-examples

說明:

API
void hidTouchRead(touchPosition *pos)

main.c

#include <3ds.h>
#include <stdio.h>
 
int main(void)
{
    touchPosition touch;
 
    gfxInitDefault();
    consoleInit(GFX_TOP, NULL);
    while (aptMainLoop()) {
        hidScanInput();
        hidTouchRead(&touch);
        
        consoleClear();
        printf("touch, x:%d, y:%d\n", touch.px, touch.py);
 
        gfxFlushBuffers();
        gfxSwapBuffers();
        gspWaitForVBlank();
    }
    gfxExit();
    return 0;
}

完成


返回上一頁