From e4d4e2680b6eef2febdf6e7eeb2485fdf51d41fb Mon Sep 17 00:00:00 2001 From: vgmoose Date: Sun, 1 Sep 2024 22:49:03 -0400 Subject: [PATCH] change pointer type on hover and unhover --- src/Element.cpp | 5 +++++ src/InputEvents.cpp | 2 +- src/RootDisplay.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Element.cpp b/src/Element.cpp index 109f738..82b2d0f 100644 --- a/src/Element.cpp +++ b/src/Element.cpp @@ -234,7 +234,12 @@ bool Element::onTouchDrag(InputEvents* event) if (this->dragging && (abs(event->yPos - this->lastMouseY) >= TRESHOLD || abs(event->xPos - this->lastMouseX) >= TRESHOLD)) { ret |= (this->elasticCounter > 0); + auto prevElasticCounter = this->elasticCounter; this->elasticCounter = NO_HIGHLIGHT; + if (prevElasticCounter != NO_HIGHLIGHT) { + // change the cursor back to the arrow + CST_SetCursor(CST_CURSOR_ARROW); + } } return ret; diff --git a/src/InputEvents.cpp b/src/InputEvents.cpp index e2901ce..0dd0df5 100644 --- a/src/InputEvents.cpp +++ b/src/InputEvents.cpp @@ -123,7 +123,7 @@ bool InputEvents::processSDLEvents() if (this->type == SDL_QUIT) { - this->quitaction(); + if (this->quitaction != NULL) this->quitaction(); return false; //Quitting overrides all other events. } else if (event.key.repeat == 0 && (this->type == SDL_KEYDOWN || this->type == SDL_KEYUP)) diff --git a/src/RootDisplay.cpp b/src/RootDisplay.cpp index b650fa3..51df6d9 100644 --- a/src/RootDisplay.cpp +++ b/src/RootDisplay.cpp @@ -58,21 +58,21 @@ RootDisplay::RootDisplay() RootDisplay::dpiScale = CST_GetDpiScale(); // set platform-specific default background colors, (which can be overridden) -#if defined(__WIIU__) +#if defined(__WIIU__) || defined(WIIU_MOCK) this->backgroundColor = fromRGB(0x20 - 0x10, 154 - 0x10, 199 - 0x10); -#elif defined(WII) +#elif defined(WII) || defined(WII_MOCK) // the system wii gray this->backgroundColor = fromRGB(0x8b, 0x8b, 0x8b); #elif defined(_3DS) || defined(_3DS_MOCK) this->backgroundColor = fromRGB(30, 30, 30); -#elif defined(SWITCH) +#elif defined(SWITCH) || defined(SWITCH_MOCK) this->backgroundColor = fromRGB(0xd6, 0x0 + 0x20, 0x12 + 0x20); #else this->backgroundColor = fromRGB(0x2d, 0x26, 0x49); #endif // set starting resolution based on SDL version -#if defined(WII) +#if defined(WII) || defined(WII_MOCK) setScreenResolution(640, 480); #elif defined(_3DS) || defined(_3DS_MOCK) setScreenResolution(400, 480); // 3ds has a special resolution! @@ -240,7 +240,7 @@ int RootDisplay::mainLoop() // if we see a minus, exit immediately! if (events->pressed(SELECT_BUTTON) && this->canUseSelectToExit) { - if (events->quitaction) events->quitaction(); + if (events->quitaction != NULL) events->quitaction(); else isRunning = false; } }