Switch: Add touch

This commit is contained in:
Vicki Pfau 2018-09-15 11:13:30 -07:00
parent 7bbc607a4c
commit c14e5dcb88
1 changed files with 14 additions and 1 deletions

View File

@ -161,6 +161,19 @@ static uint32_t _pollInput(const struct mInputMap* map) {
return keys;
}
static enum GUICursorState _pollCursor(unsigned* x, unsigned* y) {
hidScanInput();
if (hidTouchCount() < 1) {
return GUI_CURSOR_NOT_PRESENT;
}
touchPosition touch;
hidTouchRead(&touch, 0);
*x = touch.px;
*y = touch.py;
return GUI_CURSOR_DOWN;
}
static void _setup(struct mGUIRunner* runner) {
_mapKey(&runner->core->inputMap, AUTO_INPUT, KEY_A, GBA_KEY_A);
_mapKey(&runner->core->inputMap, AUTO_INPUT, KEY_B, GBA_KEY_B);
@ -377,7 +390,7 @@ int main(int argc, char* argv[]) {
width, height,
font, "/",
_drawStart, _drawEnd,
_pollInput, NULL,
_pollInput, _pollCursor,
NULL,
NULL, NULL,
},