Switch: Add touch
Vicki Pfau vi@endrift.com
Sat, 15 Sep 2018 11:13:30 -0700
1 files changed,
14 insertions(+),
1 deletions(-)
jump to
M
src/platform/switch/main.c
→
src/platform/switch/main.c
@@ -161,6 +161,19 @@ keys |= mInputMapKeyBits(map, AUTO_INPUT, padkeys, 0);
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 @@ .params = {
width, height, font, "/", _drawStart, _drawEnd, - _pollInput, NULL, + _pollInput, _pollCursor, NULL, NULL, NULL, },