From 2f5f3e4a7de3af6e87c9aa7983f92c0ee803e35e Mon Sep 17 00:00:00 2001 From: LiquidFenrir Date: Sun, 18 Apr 2021 16:31:14 +0200 Subject: [PATCH] change class name to reflect usage --- 3ds/include/CheatManagerOverlay.hpp | 2 +- 3ds/include/ErrorOverlay.hpp | 2 +- 3ds/include/InfoOverlay.hpp | 2 +- 3ds/include/MainScreen.hpp | 2 +- 3ds/include/TouchScreen.hpp | 2 +- 3ds/include/YesNoOverlay.hpp | 2 +- 3ds/source/CheatManagerOverlay.cpp | 2 +- 3ds/source/ErrorOverlay.cpp | 2 +- 3ds/source/InfoOverlay.cpp | 2 +- 3ds/source/MainScreen.cpp | 2 +- 3ds/source/YesNoOverlay.cpp | 2 +- common/Overlay.hpp | 2 +- common/Screen.cpp | 2 +- common/Screen.hpp | 6 +++--- switch/include/CheatManagerOverlay.hpp | 2 +- switch/include/ErrorOverlay.hpp | 2 +- switch/include/InfoOverlay.hpp | 2 +- switch/include/MainScreen.hpp | 8 ++++---- switch/include/TouchScreen.hpp | 2 +- switch/include/YesNoOverlay.hpp | 2 +- switch/source/CheatManagerOverlay.cpp | 2 +- switch/source/ErrorOverlay.cpp | 2 +- switch/source/InfoOverlay.cpp | 2 +- switch/source/MainScreen.cpp | 8 ++++---- switch/source/YesNoOverlay.cpp | 2 +- switch/source/main.cpp | 2 +- 26 files changed, 34 insertions(+), 34 deletions(-) diff --git a/3ds/include/CheatManagerOverlay.hpp b/3ds/include/CheatManagerOverlay.hpp index 4db17d0..969f135 100644 --- a/3ds/include/CheatManagerOverlay.hpp +++ b/3ds/include/CheatManagerOverlay.hpp @@ -45,7 +45,7 @@ public: ~CheatManagerOverlay(void); void drawTop(void) const override; void drawBottom(void) const override; - void update(TouchScreen* touch) override; + void update(InputState* touch) override; protected: void save(const std::string& key, Scrollable* s); diff --git a/3ds/include/ErrorOverlay.hpp b/3ds/include/ErrorOverlay.hpp index 0efe41b..53226eb 100644 --- a/3ds/include/ErrorOverlay.hpp +++ b/3ds/include/ErrorOverlay.hpp @@ -43,7 +43,7 @@ public: ~ErrorOverlay(void); void drawTop(void) const override; void drawBottom(void) const override; - void update(TouchScreen* touch) override; + void update(InputState* touch) override; private: u32 posx, posy; diff --git a/3ds/include/InfoOverlay.hpp b/3ds/include/InfoOverlay.hpp index 33be098..4c387e7 100644 --- a/3ds/include/InfoOverlay.hpp +++ b/3ds/include/InfoOverlay.hpp @@ -43,7 +43,7 @@ public: ~InfoOverlay(void); void drawTop(void) const override; void drawBottom(void) const override; - void update(TouchScreen* touch) override; + void update(InputState* touch) override; private: u32 posx, posy; diff --git a/3ds/include/MainScreen.hpp b/3ds/include/MainScreen.hpp index 94df07f..288bae0 100644 --- a/3ds/include/MainScreen.hpp +++ b/3ds/include/MainScreen.hpp @@ -46,7 +46,7 @@ public: ~MainScreen(void); void drawTop(void) const override; void drawBottom(void) const override; - void update(TouchScreen* touch) override; + void update(InputState* touch) override; protected: int selectorX(size_t i) const; diff --git a/3ds/include/TouchScreen.hpp b/3ds/include/TouchScreen.hpp index 613367a..97ea73a 100644 --- a/3ds/include/TouchScreen.hpp +++ b/3ds/include/TouchScreen.hpp @@ -29,6 +29,6 @@ #include <3ds.h> -using TouchScreen = touchPosition; +using InputState = touchPosition; #endif diff --git a/3ds/include/YesNoOverlay.hpp b/3ds/include/YesNoOverlay.hpp index 383c178..f288998 100644 --- a/3ds/include/YesNoOverlay.hpp +++ b/3ds/include/YesNoOverlay.hpp @@ -44,7 +44,7 @@ public: ~YesNoOverlay(void); void drawTop(void) const override; void drawBottom(void) const override; - void update(TouchScreen* touch) override; + void update(InputState* touch) override; private: u32 posx, posy; diff --git a/3ds/source/CheatManagerOverlay.cpp b/3ds/source/CheatManagerOverlay.cpp index 282dfc9..0a2222c 100644 --- a/3ds/source/CheatManagerOverlay.cpp +++ b/3ds/source/CheatManagerOverlay.cpp @@ -90,7 +90,7 @@ void CheatManagerOverlay::drawBottom(void) const C2D_DrawRectSolid(0, 0, 0.5f, 320, 240, COLOR_OVERLAY); } -void CheatManagerOverlay::update(TouchScreen* touch) +void CheatManagerOverlay::update(InputState* touch) { if (hidKeysDown() & KEY_A) { std::string cellName = scrollable->cellName(scrollable->index()); diff --git a/3ds/source/ErrorOverlay.cpp b/3ds/source/ErrorOverlay.cpp index d1f7386..dd670fc 100644 --- a/3ds/source/ErrorOverlay.cpp +++ b/3ds/source/ErrorOverlay.cpp @@ -61,7 +61,7 @@ void ErrorOverlay::drawBottom(void) const Gui::drawPulsingOutline(42, 162, 236, 36, 2, COLOR_RED); } -void ErrorOverlay::update(TouchScreen* touch) +void ErrorOverlay::update(InputState* touch) { if (button->released() || (hidKeysDown() & KEY_A) || (hidKeysDown() & KEY_B)) { screen.removeOverlay(); diff --git a/3ds/source/InfoOverlay.cpp b/3ds/source/InfoOverlay.cpp index 5f251c5..406a8b7 100644 --- a/3ds/source/InfoOverlay.cpp +++ b/3ds/source/InfoOverlay.cpp @@ -57,7 +57,7 @@ void InfoOverlay::drawBottom(void) const Gui::drawPulsingOutline(42, 162, 236, 36, 2, COLOR_BLUE); } -void InfoOverlay::update(TouchScreen* touch) +void InfoOverlay::update(InputState* touch) { if (button->released() || (hidKeysDown() & KEY_A) || (hidKeysDown() & KEY_B)) { screen.removeOverlay(); diff --git a/3ds/source/MainScreen.cpp b/3ds/source/MainScreen.cpp index dd9c1f4..1234059 100644 --- a/3ds/source/MainScreen.cpp +++ b/3ds/source/MainScreen.cpp @@ -264,7 +264,7 @@ void MainScreen::drawBottom(void) const } } -void MainScreen::update(TouchScreen* touch) +void MainScreen::update(InputState* touch) { updateSelector(); handleEvents(touch); diff --git a/3ds/source/YesNoOverlay.cpp b/3ds/source/YesNoOverlay.cpp index eb8e3fa..23f339e 100644 --- a/3ds/source/YesNoOverlay.cpp +++ b/3ds/source/YesNoOverlay.cpp @@ -72,7 +72,7 @@ void YesNoOverlay::drawBottom(void) const } } -void YesNoOverlay::update(TouchScreen* touch) +void YesNoOverlay::update(InputState* touch) { hid.update(2); diff --git a/common/Overlay.hpp b/common/Overlay.hpp index 20d8d2c..310b45a 100644 --- a/common/Overlay.hpp +++ b/common/Overlay.hpp @@ -34,7 +34,7 @@ class Overlay { public: Overlay(Screen& screen) : screen(screen), me(screen.currentOverlay) {} virtual ~Overlay() = default; - virtual void update(TouchScreen*) = 0; + virtual void update(InputState*) = 0; #if defined(_3DS) virtual void drawTop() const = 0; virtual void drawBottom() const = 0; diff --git a/common/Screen.cpp b/common/Screen.cpp index 662538a..a7e7530 100644 --- a/common/Screen.cpp +++ b/common/Screen.cpp @@ -56,7 +56,7 @@ void Screen::doDraw() const #endif -void Screen::doUpdate(TouchScreen* touch) +void Screen::doUpdate(InputState* touch) { if (currentOverlay) { currentOverlay->update(touch); diff --git a/common/Screen.hpp b/common/Screen.hpp index 59f3ae6..ef2456b 100644 --- a/common/Screen.hpp +++ b/common/Screen.hpp @@ -27,7 +27,7 @@ #ifndef SCREEN_HPP #define SCREEN_HPP -#include "TouchScreen.hpp" +#include "InputState.hpp" #include class Overlay; @@ -48,8 +48,8 @@ public: virtual void draw() const = 0; #endif // Call currentOverlay->update if it exists, and update if it doesn't - void doUpdate(TouchScreen*); - virtual void update(TouchScreen*) = 0; + void doUpdate(InputState*); + virtual void update(InputState*) = 0; void removeOverlay() { currentOverlay.reset(); } void setOverlay(std::shared_ptr& overlay) { currentOverlay = overlay; } diff --git a/switch/include/CheatManagerOverlay.hpp b/switch/include/CheatManagerOverlay.hpp index 8af0c47..0f3baf0 100644 --- a/switch/include/CheatManagerOverlay.hpp +++ b/switch/include/CheatManagerOverlay.hpp @@ -46,7 +46,7 @@ public: CheatManagerOverlay(Screen& screen, const std::string& mtext); ~CheatManagerOverlay(void) {} void draw(void) const override; - void update(TouchScreen*) override; + void update(InputState*) override; protected: void save(const std::string& key, Scrollable* s); diff --git a/switch/include/ErrorOverlay.hpp b/switch/include/ErrorOverlay.hpp index 64e17c6..724d085 100644 --- a/switch/include/ErrorOverlay.hpp +++ b/switch/include/ErrorOverlay.hpp @@ -41,7 +41,7 @@ public: ErrorOverlay(Screen& screen, Result res, const std::string& mtext); ~ErrorOverlay(void) {} void draw(void) const override; - void update(TouchScreen*) override; + void update(InputState*) override; private: u32 textw, texth; diff --git a/switch/include/InfoOverlay.hpp b/switch/include/InfoOverlay.hpp index f1fa457..a4fc72a 100644 --- a/switch/include/InfoOverlay.hpp +++ b/switch/include/InfoOverlay.hpp @@ -41,7 +41,7 @@ public: InfoOverlay(Screen& screen, const std::string& mtext); ~InfoOverlay(void) {} void draw(void) const override; - void update(TouchScreen* touch) override; + void update(InputState* touch) override; private: u32 textw, texth; diff --git a/switch/include/MainScreen.hpp b/switch/include/MainScreen.hpp index 8f44f65..dbe1bfa 100644 --- a/switch/include/MainScreen.hpp +++ b/switch/include/MainScreen.hpp @@ -48,15 +48,15 @@ class Scrollable; class MainScreen : public Screen { public: - MainScreen(TouchScreen*); + MainScreen(InputState*); void draw(void) const override; - void update(TouchScreen* pad) override; + void update(InputState* pad) override; protected: int selectorX(size_t i) const; int selectorY(size_t i) const; - void updateSelector(TouchScreen* pad); - void handleEvents(TouchScreen* pad); + void updateSelector(InputState* pad); + void handleEvents(InputState* pad); std::string nameFromCell(size_t index) const; void entryType(entryType_t type); size_t index(entryType_t type) const; diff --git a/switch/include/TouchScreen.hpp b/switch/include/TouchScreen.hpp index 17980b2..433d1f5 100644 --- a/switch/include/TouchScreen.hpp +++ b/switch/include/TouchScreen.hpp @@ -29,6 +29,6 @@ #include -struct TouchScreen : public HidTouchScreenState, public PadState { }; +struct InputState : public HidTouchScreenState, public PadState { }; #endif diff --git a/switch/include/YesNoOverlay.hpp b/switch/include/YesNoOverlay.hpp index 89a6b69..6722179 100644 --- a/switch/include/YesNoOverlay.hpp +++ b/switch/include/YesNoOverlay.hpp @@ -43,7 +43,7 @@ public: YesNoOverlay(Screen& screen, const std::string& mtext, const std::function& callbackYes, const std::function& callbackNo); ~YesNoOverlay(void) {} void draw(void) const override; - void update(TouchScreen*) override; + void update(InputState*) override; private: u32 textw, texth; diff --git a/switch/source/CheatManagerOverlay.cpp b/switch/source/CheatManagerOverlay.cpp index cc01873..9c6ce69 100644 --- a/switch/source/CheatManagerOverlay.cpp +++ b/switch/source/CheatManagerOverlay.cpp @@ -83,7 +83,7 @@ void CheatManagerOverlay::draw(void) const 20, 94, ceilf(664 + (32 - height) / 2), COLOR_WHITE, multiSelected ? "\ue003 to deselect all cheats" : "\ue003 to select all cheats"); } -void CheatManagerOverlay::update(TouchScreen* pad) +void CheatManagerOverlay::update(InputState* pad) { u64 kDown = padGetButtonsDown(pad); if (kDown & HidNpadButton_A) { diff --git a/switch/source/ErrorOverlay.cpp b/switch/source/ErrorOverlay.cpp index d9593b0..805bceb 100644 --- a/switch/source/ErrorOverlay.cpp +++ b/switch/source/ErrorOverlay.cpp @@ -45,7 +45,7 @@ void ErrorOverlay::draw(void) const drawPulsingOutline(322, 462, 636, 56, 4, COLOR_RED); } -void ErrorOverlay::update(TouchScreen* pad) +void ErrorOverlay::update(InputState* pad) { u64 kDown = padGetButtonsDown(pad); if (button->released() || (kDown & HidNpadButton_A) || (kDown & HidNpadButton_B)) { diff --git a/switch/source/InfoOverlay.cpp b/switch/source/InfoOverlay.cpp index c744dcc..f407f4d 100644 --- a/switch/source/InfoOverlay.cpp +++ b/switch/source/InfoOverlay.cpp @@ -43,7 +43,7 @@ void InfoOverlay::draw(void) const drawPulsingOutline(322, 462, 636, 56, 4, COLOR_BLUE); } -void InfoOverlay::update(TouchScreen* pad) +void InfoOverlay::update(InputState* pad) { u64 kDown = padGetButtonsDown(pad); if (button->released() || (kDown & HidNpadButton_A) || (kDown & HidNpadButton_B)) { diff --git a/switch/source/MainScreen.cpp b/switch/source/MainScreen.cpp index 3e3fe09..298c88a 100644 --- a/switch/source/MainScreen.cpp +++ b/switch/source/MainScreen.cpp @@ -28,7 +28,7 @@ static constexpr size_t rowlen = 5, collen = 4, rows = 10, SIDEBAR_w = 96; -MainScreen::MainScreen(TouchScreen* pad) : hid(rowlen * collen, collen, pad) +MainScreen::MainScreen(InputState* pad) : hid(rowlen * collen, collen, pad) { pksmBridge = false; wantInstructions = false; @@ -224,13 +224,13 @@ void MainScreen::draw() const } } -void MainScreen::update(TouchScreen* pad) +void MainScreen::update(InputState* pad) { updateSelector(pad); handleEvents(pad); } -void MainScreen::updateSelector(TouchScreen* pad) +void MainScreen::updateSelector(InputState* pad) { if (!g_backupScrollEnabled) { size_t count = getTitleCount(g_currentUId); @@ -262,7 +262,7 @@ void MainScreen::updateSelector(TouchScreen* pad) } } -void MainScreen::handleEvents(TouchScreen* pad) +void MainScreen::handleEvents(InputState* pad) { const u64 kheld = padGetButtons(pad); const u64 kdown = padGetButtonsDown(pad); diff --git a/switch/source/YesNoOverlay.cpp b/switch/source/YesNoOverlay.cpp index 55e8b58..0aa941a 100644 --- a/switch/source/YesNoOverlay.cpp +++ b/switch/source/YesNoOverlay.cpp @@ -56,7 +56,7 @@ void YesNoOverlay::draw(void) const } } -void YesNoOverlay::update(TouchScreen* pad) +void YesNoOverlay::update(InputState* pad) { hid.update(2); diff --git a/switch/source/main.cpp b/switch/source/main.cpp index 75d0999..3094db3 100644 --- a/switch/source/main.cpp +++ b/switch/source/main.cpp @@ -48,7 +48,7 @@ int main(void) exit(res); } - TouchScreen pad; + InputState pad; padInitializeDefault(&pad); g_screen = std::make_unique(&pad);