GUI: Fix non-touch support

This commit is contained in:
Jeffrey Pfau 2015-09-05 00:50:51 -07:00
parent db994ef8ab
commit 346503cd41
4 changed files with 4 additions and 4 deletions

View File

@ -238,7 +238,7 @@ static uint32_t _pollInput(void) {
static enum GUICursorState _pollCursor(int* x, int* y) { static enum GUICursorState _pollCursor(int* x, int* y) {
hidScanInput(); hidScanInput();
if (!(hidKeysHeld() & KEY_TOUCH)) { if (!(hidKeysHeld() & KEY_TOUCH)) {
return GUI_CURSOR_UP; return GUI_CURSOR_NOT_PRESENT;
} }
touchPosition pos; touchPosition pos;
hidTouchRead(&pos); hidTouchRead(&pos);

View File

@ -68,7 +68,7 @@ static enum GUICursorState _pollCursor(int* x, int* y) {
SceTouchData touch; SceTouchData touch;
sceTouchPeek(0, &touch, 1); sceTouchPeek(0, &touch, 1);
if (touch.reportNum < 1) { if (touch.reportNum < 1) {
return GUI_CURSOR_UP; return GUI_CURSOR_NOT_PRESENT;
} }
*x = touch.report[0].x / 2; *x = touch.report[0].x / 2;
*y = touch.report[0].y / 2; *y = touch.report[0].y / 2;

View File

@ -43,7 +43,7 @@ enum GUICursorState GUIPollCursor(struct GUIParams* params, int* x, int* y) {
params->cursorState = GUI_CURSOR_DRAGGING; params->cursorState = GUI_CURSOR_DRAGGING;
return GUI_CURSOR_DRAGGING; return GUI_CURSOR_DRAGGING;
} }
if (state == GUI_CURSOR_UP) { if (state == GUI_CURSOR_UP || state == GUI_CURSOR_NOT_PRESENT) {
params->cursorState = GUI_CURSOR_UP; params->cursorState = GUI_CURSOR_UP;
return GUI_CURSOR_CLICKED; return GUI_CURSOR_CLICKED;
} }

View File

@ -80,7 +80,7 @@ enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* men
return GUI_MENU_EXIT_ACCEPT; return GUI_MENU_EXIT_ACCEPT;
} }
} }
if ((cursorOverItem == 1 && cursor == GUI_CURSOR_UP)) { if (cursorOverItem == 1 && (cursor == GUI_CURSOR_UP || cursor == GUI_CURSOR_NOT_PRESENT)) {
cursorOverItem = 2; cursorOverItem = 2;
} }
if (newInput & (1 << GUI_INPUT_BACK)) { if (newInput & (1 << GUI_INPUT_BACK)) {