Fully rewrite config.

This commit is contained in:
StackZ
2020-06-20 15:22:50 +02:00
parent 7972fd483a
commit 50e4aa99e0
22 changed files with 1372 additions and 1274 deletions
+15 -14
View File
@@ -32,6 +32,7 @@
#include "settings.hpp"
#include "unistore.hpp"
extern std::unique_ptr<Config> config;
extern bool exiting;
extern bool touching(touchPosition touch, Structs::ButtonPos button);
extern int fadealpha;
@@ -41,12 +42,12 @@ extern u32 TextColor;
void MainMenu::Draw(void) const {
GFX::DrawTop();
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);
if (config->useBars() == true) {
Gui::DrawStringCentered(0, 0, 0.7f, config->textColor(), "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, config->textColor(), 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);
Gui::DrawStringCentered(0, 2, 0.7f, config->textColor(), "Universal-Updater", 400);
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, config->textColor(), V_STRING);
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
@@ -73,10 +74,10 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
// Navigation.
if(hDown & KEY_UP) {
if (hDown & KEY_UP) {
if(Selection > 1) Selection -= 2;
} else if(hDown & KEY_DOWN) {
if(Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
} else if (hDown & KEY_DOWN) {
if (Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
} else if (hDown & KEY_LEFT) {
if (Selection%2) Selection--;
} else if (hDown & KEY_RIGHT) {
@@ -86,13 +87,13 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_A) {
switch(Selection) {
case 0:
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), Config::fading, true);
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), config->screenFade(), true);
break;
case 1:
Gui::setScreen(std::make_unique<ScriptList>(), Config::fading, true);
Gui::setScreen(std::make_unique<ScriptList>(), config->screenFade(), true);
break;
case 2:
Gui::setScreen(std::make_unique<Settings>(), Config::fading, true);
Gui::setScreen(std::make_unique<Settings>(), config->screenFade(), true);
break;
case 3:
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
@@ -102,11 +103,11 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_TOUCH) {
if (touching(touch, mainButtons[0])) {
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), Config::fading, true);
Gui::setScreen(std::make_unique<UniStore>(false, "NOT_USED"), config->screenFade(), true);
} else if (touching(touch, mainButtons[1])) {
Gui::setScreen(std::make_unique<ScriptList>(), Config::fading, true);
Gui::setScreen(std::make_unique<ScriptList>(), config->screenFade(), true);
} else if (touching(touch, mainButtons[2])) {
Gui::setScreen(std::make_unique<Settings>(), Config::fading, true);
Gui::setScreen(std::make_unique<Settings>(), config->screenFade(), true);
} else if (touching(touch, mainButtons[3])) {
Gui::setScreen(std::make_unique<FTPScreen>(), false, true);
}