mirror of
https://github.com/BernardoGiordano/Checkpoint
synced 2024-11-13 21:27:06 +00:00
change class name to reflect usage
This commit is contained in:
parent
98f020f7fe
commit
2f5f3e4a7d
26 changed files with 34 additions and 34 deletions
|
@ -45,7 +45,7 @@ public:
|
||||||
~CheatManagerOverlay(void);
|
~CheatManagerOverlay(void);
|
||||||
void drawTop(void) const override;
|
void drawTop(void) const override;
|
||||||
void drawBottom(void) const override;
|
void drawBottom(void) const override;
|
||||||
void update(TouchScreen* touch) override;
|
void update(InputState* touch) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void save(const std::string& key, Scrollable* s);
|
void save(const std::string& key, Scrollable* s);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
~ErrorOverlay(void);
|
~ErrorOverlay(void);
|
||||||
void drawTop(void) const override;
|
void drawTop(void) const override;
|
||||||
void drawBottom(void) const override;
|
void drawBottom(void) const override;
|
||||||
void update(TouchScreen* touch) override;
|
void update(InputState* touch) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 posx, posy;
|
u32 posx, posy;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
~InfoOverlay(void);
|
~InfoOverlay(void);
|
||||||
void drawTop(void) const override;
|
void drawTop(void) const override;
|
||||||
void drawBottom(void) const override;
|
void drawBottom(void) const override;
|
||||||
void update(TouchScreen* touch) override;
|
void update(InputState* touch) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 posx, posy;
|
u32 posx, posy;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
~MainScreen(void);
|
~MainScreen(void);
|
||||||
void drawTop(void) const override;
|
void drawTop(void) const override;
|
||||||
void drawBottom(void) const override;
|
void drawBottom(void) const override;
|
||||||
void update(TouchScreen* touch) override;
|
void update(InputState* touch) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int selectorX(size_t i) const;
|
int selectorX(size_t i) const;
|
||||||
|
|
|
@ -29,6 +29,6 @@
|
||||||
|
|
||||||
#include <3ds.h>
|
#include <3ds.h>
|
||||||
|
|
||||||
using TouchScreen = touchPosition;
|
using InputState = touchPosition;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
~YesNoOverlay(void);
|
~YesNoOverlay(void);
|
||||||
void drawTop(void) const override;
|
void drawTop(void) const override;
|
||||||
void drawBottom(void) const override;
|
void drawBottom(void) const override;
|
||||||
void update(TouchScreen* touch) override;
|
void update(InputState* touch) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 posx, posy;
|
u32 posx, posy;
|
||||||
|
|
|
@ -90,7 +90,7 @@ void CheatManagerOverlay::drawBottom(void) const
|
||||||
C2D_DrawRectSolid(0, 0, 0.5f, 320, 240, COLOR_OVERLAY);
|
C2D_DrawRectSolid(0, 0, 0.5f, 320, 240, COLOR_OVERLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatManagerOverlay::update(TouchScreen* touch)
|
void CheatManagerOverlay::update(InputState* touch)
|
||||||
{
|
{
|
||||||
if (hidKeysDown() & KEY_A) {
|
if (hidKeysDown() & KEY_A) {
|
||||||
std::string cellName = scrollable->cellName(scrollable->index());
|
std::string cellName = scrollable->cellName(scrollable->index());
|
||||||
|
|
|
@ -61,7 +61,7 @@ void ErrorOverlay::drawBottom(void) const
|
||||||
Gui::drawPulsingOutline(42, 162, 236, 36, 2, COLOR_RED);
|
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)) {
|
if (button->released() || (hidKeysDown() & KEY_A) || (hidKeysDown() & KEY_B)) {
|
||||||
screen.removeOverlay();
|
screen.removeOverlay();
|
||||||
|
|
|
@ -57,7 +57,7 @@ void InfoOverlay::drawBottom(void) const
|
||||||
Gui::drawPulsingOutline(42, 162, 236, 36, 2, COLOR_BLUE);
|
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)) {
|
if (button->released() || (hidKeysDown() & KEY_A) || (hidKeysDown() & KEY_B)) {
|
||||||
screen.removeOverlay();
|
screen.removeOverlay();
|
||||||
|
|
|
@ -264,7 +264,7 @@ void MainScreen::drawBottom(void) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainScreen::update(TouchScreen* touch)
|
void MainScreen::update(InputState* touch)
|
||||||
{
|
{
|
||||||
updateSelector();
|
updateSelector();
|
||||||
handleEvents(touch);
|
handleEvents(touch);
|
||||||
|
|
|
@ -72,7 +72,7 @@ void YesNoOverlay::drawBottom(void) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void YesNoOverlay::update(TouchScreen* touch)
|
void YesNoOverlay::update(InputState* touch)
|
||||||
{
|
{
|
||||||
hid.update(2);
|
hid.update(2);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Overlay {
|
||||||
public:
|
public:
|
||||||
Overlay(Screen& screen) : screen(screen), me(screen.currentOverlay) {}
|
Overlay(Screen& screen) : screen(screen), me(screen.currentOverlay) {}
|
||||||
virtual ~Overlay() = default;
|
virtual ~Overlay() = default;
|
||||||
virtual void update(TouchScreen*) = 0;
|
virtual void update(InputState*) = 0;
|
||||||
#if defined(_3DS)
|
#if defined(_3DS)
|
||||||
virtual void drawTop() const = 0;
|
virtual void drawTop() const = 0;
|
||||||
virtual void drawBottom() const = 0;
|
virtual void drawBottom() const = 0;
|
||||||
|
|
|
@ -56,7 +56,7 @@ void Screen::doDraw() const
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Screen::doUpdate(TouchScreen* touch)
|
void Screen::doUpdate(InputState* touch)
|
||||||
{
|
{
|
||||||
if (currentOverlay) {
|
if (currentOverlay) {
|
||||||
currentOverlay->update(touch);
|
currentOverlay->update(touch);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#ifndef SCREEN_HPP
|
#ifndef SCREEN_HPP
|
||||||
#define SCREEN_HPP
|
#define SCREEN_HPP
|
||||||
|
|
||||||
#include "TouchScreen.hpp"
|
#include "InputState.hpp"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class Overlay;
|
class Overlay;
|
||||||
|
@ -48,8 +48,8 @@ public:
|
||||||
virtual void draw() const = 0;
|
virtual void draw() const = 0;
|
||||||
#endif
|
#endif
|
||||||
// Call currentOverlay->update if it exists, and update if it doesn't
|
// Call currentOverlay->update if it exists, and update if it doesn't
|
||||||
void doUpdate(TouchScreen*);
|
void doUpdate(InputState*);
|
||||||
virtual void update(TouchScreen*) = 0;
|
virtual void update(InputState*) = 0;
|
||||||
void removeOverlay() { currentOverlay.reset(); }
|
void removeOverlay() { currentOverlay.reset(); }
|
||||||
void setOverlay(std::shared_ptr<Overlay>& overlay) { currentOverlay = overlay; }
|
void setOverlay(std::shared_ptr<Overlay>& overlay) { currentOverlay = overlay; }
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
CheatManagerOverlay(Screen& screen, const std::string& mtext);
|
CheatManagerOverlay(Screen& screen, const std::string& mtext);
|
||||||
~CheatManagerOverlay(void) {}
|
~CheatManagerOverlay(void) {}
|
||||||
void draw(void) const override;
|
void draw(void) const override;
|
||||||
void update(TouchScreen*) override;
|
void update(InputState*) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void save(const std::string& key, Scrollable* s);
|
void save(const std::string& key, Scrollable* s);
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
ErrorOverlay(Screen& screen, Result res, const std::string& mtext);
|
ErrorOverlay(Screen& screen, Result res, const std::string& mtext);
|
||||||
~ErrorOverlay(void) {}
|
~ErrorOverlay(void) {}
|
||||||
void draw(void) const override;
|
void draw(void) const override;
|
||||||
void update(TouchScreen*) override;
|
void update(InputState*) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 textw, texth;
|
u32 textw, texth;
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
InfoOverlay(Screen& screen, const std::string& mtext);
|
InfoOverlay(Screen& screen, const std::string& mtext);
|
||||||
~InfoOverlay(void) {}
|
~InfoOverlay(void) {}
|
||||||
void draw(void) const override;
|
void draw(void) const override;
|
||||||
void update(TouchScreen* touch) override;
|
void update(InputState* touch) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 textw, texth;
|
u32 textw, texth;
|
||||||
|
|
|
@ -48,15 +48,15 @@ class Scrollable;
|
||||||
|
|
||||||
class MainScreen : public Screen {
|
class MainScreen : public Screen {
|
||||||
public:
|
public:
|
||||||
MainScreen(TouchScreen*);
|
MainScreen(InputState*);
|
||||||
void draw(void) const override;
|
void draw(void) const override;
|
||||||
void update(TouchScreen* pad) override;
|
void update(InputState* pad) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int selectorX(size_t i) const;
|
int selectorX(size_t i) const;
|
||||||
int selectorY(size_t i) const;
|
int selectorY(size_t i) const;
|
||||||
void updateSelector(TouchScreen* pad);
|
void updateSelector(InputState* pad);
|
||||||
void handleEvents(TouchScreen* pad);
|
void handleEvents(InputState* pad);
|
||||||
std::string nameFromCell(size_t index) const;
|
std::string nameFromCell(size_t index) const;
|
||||||
void entryType(entryType_t type);
|
void entryType(entryType_t type);
|
||||||
size_t index(entryType_t type) const;
|
size_t index(entryType_t type) const;
|
||||||
|
|
|
@ -29,6 +29,6 @@
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
struct TouchScreen : public HidTouchScreenState, public PadState { };
|
struct InputState : public HidTouchScreenState, public PadState { };
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
YesNoOverlay(Screen& screen, const std::string& mtext, const std::function<void()>& callbackYes, const std::function<void()>& callbackNo);
|
YesNoOverlay(Screen& screen, const std::string& mtext, const std::function<void()>& callbackYes, const std::function<void()>& callbackNo);
|
||||||
~YesNoOverlay(void) {}
|
~YesNoOverlay(void) {}
|
||||||
void draw(void) const override;
|
void draw(void) const override;
|
||||||
void update(TouchScreen*) override;
|
void update(InputState*) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 textw, texth;
|
u32 textw, texth;
|
||||||
|
|
|
@ -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");
|
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);
|
u64 kDown = padGetButtonsDown(pad);
|
||||||
if (kDown & HidNpadButton_A) {
|
if (kDown & HidNpadButton_A) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ void ErrorOverlay::draw(void) const
|
||||||
drawPulsingOutline(322, 462, 636, 56, 4, COLOR_RED);
|
drawPulsingOutline(322, 462, 636, 56, 4, COLOR_RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorOverlay::update(TouchScreen* pad)
|
void ErrorOverlay::update(InputState* pad)
|
||||||
{
|
{
|
||||||
u64 kDown = padGetButtonsDown(pad);
|
u64 kDown = padGetButtonsDown(pad);
|
||||||
if (button->released() || (kDown & HidNpadButton_A) || (kDown & HidNpadButton_B)) {
|
if (button->released() || (kDown & HidNpadButton_A) || (kDown & HidNpadButton_B)) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ void InfoOverlay::draw(void) const
|
||||||
drawPulsingOutline(322, 462, 636, 56, 4, COLOR_BLUE);
|
drawPulsingOutline(322, 462, 636, 56, 4, COLOR_BLUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoOverlay::update(TouchScreen* pad)
|
void InfoOverlay::update(InputState* pad)
|
||||||
{
|
{
|
||||||
u64 kDown = padGetButtonsDown(pad);
|
u64 kDown = padGetButtonsDown(pad);
|
||||||
if (button->released() || (kDown & HidNpadButton_A) || (kDown & HidNpadButton_B)) {
|
if (button->released() || (kDown & HidNpadButton_A) || (kDown & HidNpadButton_B)) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
static constexpr size_t rowlen = 5, collen = 4, rows = 10, SIDEBAR_w = 96;
|
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;
|
pksmBridge = false;
|
||||||
wantInstructions = false;
|
wantInstructions = false;
|
||||||
|
@ -224,13 +224,13 @@ void MainScreen::draw() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainScreen::update(TouchScreen* pad)
|
void MainScreen::update(InputState* pad)
|
||||||
{
|
{
|
||||||
updateSelector(pad);
|
updateSelector(pad);
|
||||||
handleEvents(pad);
|
handleEvents(pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainScreen::updateSelector(TouchScreen* pad)
|
void MainScreen::updateSelector(InputState* pad)
|
||||||
{
|
{
|
||||||
if (!g_backupScrollEnabled) {
|
if (!g_backupScrollEnabled) {
|
||||||
size_t count = getTitleCount(g_currentUId);
|
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 kheld = padGetButtons(pad);
|
||||||
const u64 kdown = padGetButtonsDown(pad);
|
const u64 kdown = padGetButtonsDown(pad);
|
||||||
|
|
|
@ -56,7 +56,7 @@ void YesNoOverlay::draw(void) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void YesNoOverlay::update(TouchScreen* pad)
|
void YesNoOverlay::update(InputState* pad)
|
||||||
{
|
{
|
||||||
hid.update(2);
|
hid.update(2);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ int main(void)
|
||||||
exit(res);
|
exit(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
TouchScreen pad;
|
InputState pad;
|
||||||
padInitializeDefault(&pad);
|
padInitializeDefault(&pad);
|
||||||
|
|
||||||
g_screen = std::make_unique<MainScreen>(&pad);
|
g_screen = std::make_unique<MainScreen>(&pad);
|
||||||
|
|
Loading…
Reference in a new issue