Add Arrows for Entry Selection stuff.

This commit is contained in:
SuperSaiyajinStackZ
2019-12-22 00:21:53 +01:00
parent fb1d00049c
commit 5f5fcc3f24
10 changed files with 123 additions and 10 deletions
+23
View File
@@ -34,6 +34,7 @@
#include "utils/formatting.hpp"
#include "utils/scriptHelper.hpp"
extern bool touching(touchPosition touch, Structs::ButtonPos button);
#define ENTRIES_PER_SCREEN 3
#define ENTRIES_PER_LIST 7
@@ -105,6 +106,8 @@ void TinyDB::Draw(void) const {
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
// Search Icon.
Gui::sprite(sprites_search_idx, -3, 0);
Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
@@ -145,6 +148,26 @@ void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
fastMode = false;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[0])) {
if (selection > 0) {
selection--;
selectedOption = tinyDBList[selection];
} else {
selection = (int)tinyDBList.size()-1;
selectedOption = tinyDBList[selection];
}
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[1])) {
if (selection < (int)tinyDBList.size()-1) {
selection++;
selectedOption = tinyDBList[selection];
} else {
selection = 0;
selectedOption = tinyDBList[selection];
}
}
if (hHeld & KEY_UP && !keyRepeatDelay) {
if (selection > 0) {
selection--;