mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +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.",
|
||||
"AVAILABLE_DOWNLOADS": "Available Downloads",
|
||||
"BOOT_TITLE": "Would you like to boot this title?",
|
||||
"CANCEL": "Cancel",
|
||||
"CATEGORY": "Category",
|
||||
"CHANGE_3DSX_PATH": "Change 3DSX path",
|
||||
"CHANGE_ARCHIVE_PATH": "Change archive path",
|
||||
@@ -27,6 +28,7 @@
|
||||
"CHECK_UU_UPDATES": "Checking for Universal-Updater updates...",
|
||||
"CONFIRM_OR_CANCEL": "Press \uE000 to confirm, \uE001 to cancel.",
|
||||
"CONNECT_WIFI": "Please Connect to WiFi.",
|
||||
"CONFIRM": "Confirm",
|
||||
"CONSOLE": "Console",
|
||||
"CONTRIBUTOR_TRANSLATORS": "- All Translators & Contributors",
|
||||
"COPYING": "Copying... %s / %s (%.2f%%)",
|
||||
|
||||
+18
-2
@@ -27,6 +27,16 @@
|
||||
#include "common.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.
|
||||
|
||||
@@ -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);
|
||||
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);
|
||||
|
||||
for (int i = 0; i < 3; i++) gspWaitForVBlank();
|
||||
hidScanInput();
|
||||
|
||||
uint32_t Down = 0;
|
||||
touchPosition Touch;
|
||||
while(1) {
|
||||
do {
|
||||
gspWaitForVBlank();
|
||||
hidScanInput();
|
||||
Down = hidKeysDown();
|
||||
hidTouchRead(&Touch);
|
||||
} while (!Down);
|
||||
|
||||
if (Down & KEY_A) return true;
|
||||
else if (Down & KEY_B) return false;
|
||||
if ((Down & KEY_A) || (Down & KEY_TOUCH && touching(Touch, promptButtons[1]))) return true;
|
||||
else if ((Down & KEY_B) || (Down & KEY_TOUCH && touching(Touch, promptButtons[0]))) return false;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user