Add second Settingspage and make bars changeable.

This commit is contained in:
StackZ
2019-12-25 23:18:09 +01:00
parent 0fb5d03a87
commit b6d6e6357a
13 changed files with 217 additions and 40 deletions
+5 -1
View File
@@ -55,7 +55,11 @@ void FTPScreen::Draw(void) const
Gui::clearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
Gui::DrawTop();
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
if (Config::UseBars == true) {
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
} else {
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 2, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
ret = ACU_GetWifiStatus(&wifiStatus);
+9 -2
View File
@@ -50,8 +50,15 @@ bool isTesting = false;
void MainMenu::Draw(void) const {
Gui::DrawTop();
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
+7 -2
View File
@@ -114,8 +114,13 @@ void ScriptBrowse::Draw(void) const {
revision += " / ";
revision += std::to_string(int64_t(infoJson[selection]["revision"]));
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400);
if (Config::UseBars == true) {
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400);
} else {
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 237-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400);
}
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(infoJson[selection]["shortDesc"]), 400);
if(infoJson[selection]["curRevision"] < infoJson[selection]["revision"]) {
+14 -5
View File
@@ -278,9 +278,13 @@ void ScriptList::DrawList(void) const {
std::string line2;
std::string scriptAmount = std::to_string(selection +1) + " / " + std::to_string(fileInfo.size());
Gui::DrawTop();
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 237-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
}
Gui::DrawStringCentered(0, 80, 0.7f, Config::TxtColor, Lang::get("TITLE") + std::string(fileInfo[selection].title), 400);
Gui::DrawStringCentered(0, 100, 0.7f, Config::TxtColor, Lang::get("AUTHOR") + std::string(fileInfo[selection].author), 400);
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(fileInfo[selection].shortDesc), 400);
@@ -337,8 +341,13 @@ void ScriptList::DrawSingleObject(void) const {
std::string info;
std::string entryAmount = std::to_string(selection2+1) + " / " + std::to_string(fileInfo2.size());
Gui::DrawTop();
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, selectedTitle, 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, selectedTitle, 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, selectedTitle, 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
}
for(uint i=0;i<lines.size();i++) {
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
}
+114 -7
View File
@@ -47,15 +47,22 @@ void Settings::Draw(void) const {
DrawColorChanging();
} else if (mode == 3) {
DrawCreditsScreen();
} else if (mode == 4) {
DrawMiscSettings();
}
}
void Settings::DrawSubMenu(void) const {
Gui::DrawTop();
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
Gui::DrawArrow(318, 240, 180.0, 1);
for (int i = 0; i < 3; i++) {
if (Selection == i) {
@@ -72,7 +79,11 @@ void Settings::DrawSubMenu(void) const {
void Settings::DrawLanguageSelection(void) const {
Gui::DrawTop();
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
}
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
@@ -99,7 +110,11 @@ void Settings::DrawLanguageSelection(void) const {
void Settings::DrawColorChanging(void) const {
Gui::DrawTop();
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
}
if (colorMode == 3) {
Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor);
@@ -184,7 +199,11 @@ void Settings::DrawCreditsScreen(void) const {
std::string title = "Universal-Updater - ";
title += Lang::get("CREDITS");
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400);
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, title, 400);
}
Gui::DrawStringCentered(0, 40, 0.8f, Config::TxtColor, Lang::get("DEVELOPED_BY"), 400);
Gui::DrawStringCentered(0, 70, 0.8f, Config::TxtColor, Lang::get("MAIN_DEV"), 400);
Gui::sprite(sprites_voltZ_idx, 150, 115);
@@ -211,14 +230,92 @@ void Settings::DrawCreditsScreen(void) const {
}
}
void Settings::DrawMiscSettings(void) const {
Gui::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
}
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
for (int i = 0; i < 3; i++) {
if (Selection == i) {
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::SelectedColor);
} else {
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor);
}
}
Gui::DrawStringCentered(0, mainButtons[0].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_BARS"), 140);
Gui::DrawStringCentered(0, mainButtons[1].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_SCRIPTPATH"), 140);
Gui::DrawStringCentered(0, mainButtons[2].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_MUSICFILE"), 140);
}
void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_UP) {
if(Selection > 0) Selection--;
}
if (hDown & KEY_Y) {
Config::ScriptPath = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"));
if (hDown & KEY_DOWN) {
if(Selection < 2) Selection++;
}
if (hDown & KEY_A) {
if (Selection == 0) {
if (Config::UseBars == true) {
Config::UseBars = false;
} else if (Config::UseBars == false) {
Config::UseBars = true;
}
} else if (Selection == 1) {
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
if (tempScript != "") {
Config::ScriptPath = tempScript;
}
} else if (Selection == 2) {
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
if (tempMusic != "") {
Config::MusicPath = tempMusic;
}
}
}
if (hDown & KEY_TOUCH) {
if (touching(touch, mainButtons[0])) {
if (Config::UseBars == true) {
Config::UseBars = false;
} else if (Config::UseBars == false) {
Config::UseBars = true;
}
} else if (touching(touch, mainButtons[1])) {
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
if (tempScript != "") {
Config::ScriptPath = tempScript;
}
} else if (touching(touch, mainButtons[2])) {
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
if (tempMusic != "") {
Config::MusicPath = tempMusic;
}
}
}
if (hDown & KEY_B || hDown & KEY_L) {
mode = 0;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
mode = 0;
}
}
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_UP) {
if(Selection > 0) Selection--;
}
if (hDown & KEY_DOWN) {
@@ -258,6 +355,14 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
Screen::back();
return;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[4])) {
mode = 4;
}
if (hDown & KEY_R) {
mode = 4;
}
}
void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
@@ -457,5 +562,7 @@ void Settings::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
colorChanging(hDown, touch);
} else if (mode == 3) {
CreditsLogic(hDown, touch);
} else if (mode == 4) {
MiscSettingsLogic(hDown, hHeld, touch);
}
}
+15 -7
View File
@@ -78,13 +78,22 @@ TinyDB::TinyDB() {
}
void TinyDB::Draw(void) const {
std::string entryAmount = std::to_string(selection+1) + " / " + std::to_string(tinyDBList.size());
std::string info;
Gui::setDraw(top);
Gui::Draw_Rect(0, 0, 400, 25, C2D_Color32(63, 81, 181, 255));
Gui::Draw_Rect(0, 25, 400, 190, C2D_Color32(140, 140, 140, 255));
Gui::Draw_Rect(0, 215, 400, 25, C2D_Color32(63, 81, 181, 255));
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
if (Config::UseBars == true) {
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "TinyDB", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "TinyDB", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
}
Gui::DrawStringCentered(0, 35, 0.6f, Config::TxtColor, Lang::get("AUTHOR") + std::string(tinyDBJson[selectedOption]["info"]["author"]), 400);
Gui::DrawStringCentered(0, 65, 0.6f, Config::TxtColor, Lang::get("DESC") + std::string(tinyDBJson[selectedOption]["info"]["description"]), 400);
@@ -92,17 +101,16 @@ void TinyDB::Draw(void) const {
Gui::DrawStringCentered(0, 125, 0.6f, Config::TxtColor, Lang::get("RELEASE_ID") + std::string(tinyDBJson[selectedOption]["info"]["releaseId"]), 400);
Gui::DrawStringCentered(0, 155, 0.6f, Config::TxtColor, Lang::get("TITLE_ID") + std::string(tinyDBJson[selectedOption]["info"]["titleid"]), 400);
Gui::DrawStringCentered(0, 185, 0.6f, Config::TxtColor, Lang::get("FILE_SIZE") + formatBytes(int64_t(tinyDBJson[selectedOption]["info"]["fileSize"])), 400);
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "TinyDB", 400);
std::string entryAmount = std::to_string(selection+1) + " / " + std::to_string(tinyDBList.size());
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
Gui::setDraw(bottom);
Gui::Draw_Rect(0, 0, 320, 25, C2D_Color32(63, 81, 181, 255));
Gui::Draw_Rect(0, 25, 320, 190, C2D_Color32(140, 140, 140, 255));
Gui::Draw_Rect(0, 215, 320, 25, C2D_Color32(63, 81, 181, 255));
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
if (Config::UseBars == true) {
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
}
Gui::DrawArrow(295, -1);
Gui::DrawArrow(315, 240, 180.0);