mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Add touch screen buttons to prompt messages
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
"AUTO_UPDATE_UU_DESC": "When enabled, Universal-Updater will check for updates every time it's opened.",
|
"AUTO_UPDATE_UU_DESC": "When enabled, Universal-Updater will check for updates every time it's opened.",
|
||||||
"AVAILABLE_DOWNLOADS": "Available Downloads",
|
"AVAILABLE_DOWNLOADS": "Available Downloads",
|
||||||
"BOOT_TITLE": "Would you like to boot this title?",
|
"BOOT_TITLE": "Would you like to boot this title?",
|
||||||
|
"CANCEL": "Cancel",
|
||||||
"CATEGORY": "Category",
|
"CATEGORY": "Category",
|
||||||
"CHANGE_3DSX_PATH": "Change 3DSX path",
|
"CHANGE_3DSX_PATH": "Change 3DSX path",
|
||||||
"CHANGE_ARCHIVE_PATH": "Change archive path",
|
"CHANGE_ARCHIVE_PATH": "Change archive path",
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
"CHECK_UU_UPDATES": "Checking for Universal-Updater updates...",
|
"CHECK_UU_UPDATES": "Checking for Universal-Updater updates...",
|
||||||
"CONFIRM_OR_CANCEL": "Press \uE000 to confirm, \uE001 to cancel.",
|
"CONFIRM_OR_CANCEL": "Press \uE000 to confirm, \uE001 to cancel.",
|
||||||
"CONNECT_WIFI": "Please Connect to WiFi.",
|
"CONNECT_WIFI": "Please Connect to WiFi.",
|
||||||
|
"CONFIRM": "Confirm",
|
||||||
"CONSOLE": "Console",
|
"CONSOLE": "Console",
|
||||||
"CONTRIBUTOR_TRANSLATORS": "- All Translators & Contributors",
|
"CONTRIBUTOR_TRANSLATORS": "- All Translators & Contributors",
|
||||||
"COPYING": "Copying... %s / %s (%.2f%%)",
|
"COPYING": "Copying... %s / %s (%.2f%%)",
|
||||||
|
|||||||
+18
-2
@@ -27,6 +27,16 @@
|
|||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "msg.hpp"
|
#include "msg.hpp"
|
||||||
|
|
||||||
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
|
|
||||||
|
const std::vector<Structs::ButtonPos> promptButtons = {
|
||||||
|
{24, 94, 124, 48},
|
||||||
|
{172, 94, 124, 48}
|
||||||
|
};
|
||||||
|
const std::vector<std::string> promptLabels = {
|
||||||
|
"CANCEL", "CONFIRM"
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Displays just a message until the next draw frame.
|
Displays just a message until the next draw frame.
|
||||||
|
|
||||||
@@ -84,21 +94,27 @@ bool Msg::promptMsg(const std::string &promptMsg) {
|
|||||||
|
|
||||||
Gui::DrawStringCentered(0, 218, 0.6f, UIThemes->TextColor(), Lang::get("CONFIRM_OR_CANCEL"), 390, 0, font);
|
Gui::DrawStringCentered(0, 218, 0.6f, UIThemes->TextColor(), Lang::get("CONFIRM_OR_CANCEL"), 390, 0, font);
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
|
for(uint i = 0; i < promptButtons.size(); i++) {
|
||||||
|
Gui::Draw_Rect(promptButtons[i].x, promptButtons[i].y, promptButtons[i].w, promptButtons[i].h, UIThemes->BarColor());
|
||||||
|
Gui::DrawStringCentered(promptButtons[i].x - 160 + promptButtons[i].w / 2, promptButtons[i].y + 15, 0.6f, UIThemes->TextColor(), Lang::get(promptLabels[i]), promptButtons[i].w - 10, 0, font);
|
||||||
|
}
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) gspWaitForVBlank();
|
for (int i = 0; i < 3; i++) gspWaitForVBlank();
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
|
||||||
uint32_t Down = 0;
|
uint32_t Down = 0;
|
||||||
|
touchPosition Touch;
|
||||||
while(1) {
|
while(1) {
|
||||||
do {
|
do {
|
||||||
gspWaitForVBlank();
|
gspWaitForVBlank();
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
Down = hidKeysDown();
|
Down = hidKeysDown();
|
||||||
|
hidTouchRead(&Touch);
|
||||||
} while (!Down);
|
} while (!Down);
|
||||||
|
|
||||||
if (Down & KEY_A) return true;
|
if ((Down & KEY_A) || (Down & KEY_TOUCH && touching(Touch, promptButtons[1]))) return true;
|
||||||
else if (Down & KEY_B) return false;
|
else if ((Down & KEY_B) || (Down & KEY_TOUCH && touching(Touch, promptButtons[0]))) return false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user