This commit is contained in:
StackZ
2020-05-06 06:41:39 +02:00
parent c8289ff632
commit 0d0647038b
4 changed files with 90 additions and 21 deletions
+1
View File
@@ -42,6 +42,7 @@ private:
int creditsPage = 0; int creditsPage = 0;
int screenPos = 0; int screenPos = 0;
int Selection = 0; int Selection = 0;
int keyRepeatDelay = 0;
std::vector<Structs::ButtonPos> arrowPos = { std::vector<Structs::ButtonPos> arrowPos = {
{0, 215, 25, 25}, // Back Arrow. {0, 215, 25, 25}, // Back Arrow.
+3 -2
View File
@@ -46,6 +46,7 @@ private:
bool dropDownMenu = false; bool dropDownMenu = false;
mutable int screenPos = 0; mutable int screenPos = 0;
int colorSelection = 0; int colorSelection = 0;
int keyRepeatDelay = 0;
// Draws. // Draws.
void DrawSubMenu(void) const; void DrawSubMenu(void) const;
@@ -54,8 +55,8 @@ private:
void DrawMiscSettings(void) const; void DrawMiscSettings(void) const;
// Logic's. // Logic's.
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
void LanguageSelection(u32 hDown, touchPosition touch); void LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch);
void colorChanging(u32 hDown, touchPosition touch); void colorChanging(u32 hDown, u32 hHeld, touchPosition touch);
void MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch); void MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch);
std::vector<Structs::ButtonPos> mainButtons = { std::vector<Structs::ButtonPos> mainButtons = {
+42 -4
View File
@@ -146,16 +146,54 @@ void Credits::DrawBottom(void) const {
void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) { void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (keyRepeatDelay) keyRepeatDelay--;
// KEY_DOWN Logic. (SIZE) // KEY_DOWN Logic. (SIZE)
if (creditsPage == 0) { if (creditsPage == 0) {
if (hDown & KEY_DOWN) { if (Selection < (int)Translators.size()-1) Selection++; } if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
if (Selection < (int)Translators.size()-1) {
Selection++;
} else {
Selection = 0;
}
keyRepeatDelay = Config::keyDelay;
}
} else if (creditsPage == 1) { } else if (creditsPage == 1) {
if (hDown & KEY_DOWN) { if (Selection < (int)UniversalTeam.size()-1) Selection++; } if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
if (Selection < (int)UniversalTeam.size()-1) {
Selection++;
} else {
Selection = 0;
}
keyRepeatDelay = Config::keyDelay;
}
} else if (creditsPage == 2) { } else if (creditsPage == 2) {
if (hDown & KEY_DOWN) { if (Selection < (int)ScriptCreators.size()-1) Selection++; } if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
if (Selection < (int)ScriptCreators.size()-1) {
Selection++;
} else {
Selection = 0;
}
keyRepeatDelay = Config::keyDelay;
}
} }
if (hDown & KEY_UP) { if (Selection > 0) Selection--; } if ((hHeld & KEY_UP && !keyRepeatDelay)) {
if (Selection > 0) {
Selection--;
} else {
if (creditsPage == 0) {
Selection = (int)Translators.size()-1;
} else if (creditsPage == 1) {
Selection = (int)UniversalTeam.size()-1;
} else if (creditsPage == 2) {
Selection = (int)ScriptCreators.size()-1;
}
}
keyRepeatDelay = Config::keyDelay;
}
if ((hDown & KEY_L || hDown & KEY_LEFT)) { if ((hDown & KEY_L || hDown & KEY_LEFT)) {
+44 -15
View File
@@ -343,11 +343,27 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
} }
std::string langsTemp[] = {"br", "da", "de", "en", "es", "fr", "it", "lt", "pl", "pt", "ru", "jp"}; std::string langsTemp[] = {"br", "da", "de", "en", "es", "fr", "it", "lt", "pl", "pt", "ru", "jp"};
void Settings::LanguageSelection(u32 hDown, touchPosition touch) { void Settings::LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_UP) { if (keyRepeatDelay) keyRepeatDelay--;
if(selectedLang > 0) {
selectedLang--; if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
if (selectedLang < (int)languages.size()-1) {
selectedLang++;
} else {
selectedLang = 0;
} }
keyRepeatDelay = Config::keyDelay;
}
if ((hHeld & KEY_UP && !keyRepeatDelay)) {
if (selectedLang > 0) {
selectedLang--;
} else {
selectedLang = (int)languages.size()-1;
}
keyRepeatDelay = Config::keyDelay;
} }
if (hDown & KEY_A) { if (hDown & KEY_A) {
@@ -357,12 +373,6 @@ void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
mode = 0; mode = 0;
} }
if (hDown & KEY_DOWN) {
if(selectedLang < (int)languages.size()-1) {
selectedLang++;
}
}
if ((hDown & KEY_B)) { if ((hDown & KEY_B)) {
mode = 0; mode = 0;
} }
@@ -374,7 +384,8 @@ void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
} }
void Settings::colorChanging(u32 hDown, touchPosition touch) { void Settings::colorChanging(u32 hDown, u32 hHeld, touchPosition touch) {
if (keyRepeatDelay) keyRepeatDelay--;
int red; int red;
int green; int green;
int blue; int blue;
@@ -385,8 +396,26 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
dropDownMenu = false; dropDownMenu = false;
} }
if (hDown & KEY_UP) { if (colorSelection > 0) colorSelection--; } if ((hHeld & KEY_DOWN && !keyRepeatDelay)) {
if (hDown & KEY_DOWN) { if (colorSelection < (int)colorList.size()-1) colorSelection++; } if (colorSelection < (int)colorList.size()-1) {
colorSelection++;
} else {
colorSelection = 0;
}
keyRepeatDelay = Config::keyDelay;
}
if ((hHeld & KEY_UP && !keyRepeatDelay)) {
if (colorSelection > 0) {
colorSelection--;
} else {
colorSelection = (int)colorList.size()-1;
}
keyRepeatDelay = Config::keyDelay;
}
} else { } else {
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) { if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
@@ -514,9 +543,9 @@ void Settings::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (mode == 0) { if (mode == 0) {
SubMenuLogic(hDown, hHeld, touch); SubMenuLogic(hDown, hHeld, touch);
} else if (mode == 1) { } else if (mode == 1) {
LanguageSelection(hDown, touch); LanguageSelection(hDown, hHeld, touch);
} else if (mode == 2) { } else if (mode == 2) {
colorChanging(hDown, touch); colorChanging(hDown, hHeld, touch);
} else if (mode == 4) { } else if (mode == 4) {
MiscSettingsLogic(hDown, hHeld, touch); MiscSettingsLogic(hDown, hHeld, touch);
} }