mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-04 16:49:06 +00:00
Add Scrolling.
This commit is contained in:
@@ -41,6 +41,8 @@
|
|||||||
#define BarColor C2D_Color32(57, 84, 114, 255)
|
#define BarColor C2D_Color32(57, 84, 114, 255)
|
||||||
#define TopBGColor C2D_Color32(96, 168, 192, 255)
|
#define TopBGColor C2D_Color32(96, 168, 192, 255)
|
||||||
#define BottomBGColor C2D_Color32(38, 44, 77, 255)
|
#define BottomBGColor C2D_Color32(38, 44, 77, 255)
|
||||||
|
#define SelectedColor C2D_Color32(120, 192, 216, 255)
|
||||||
|
#define UnselectedColor C2D_Color32(77, 118, 132, 255)
|
||||||
#define BLACK C2D_Color32(0, 0, 0, 255)
|
#define BLACK C2D_Color32(0, 0, 0, 255)
|
||||||
#define WHITE C2D_Color32(255, 255, 255, 255)
|
#define WHITE C2D_Color32(255, 255, 255, 255)
|
||||||
#define TextColor C2D_Color32(102, 179, 255, 255)
|
#define TextColor C2D_Color32(102, 179, 255, 255)
|
||||||
|
|||||||
@@ -37,10 +37,12 @@ public:
|
|||||||
void Draw(void) const override;
|
void Draw(void) const override;
|
||||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||||
ScriptList();
|
ScriptList();
|
||||||
|
void showParsedObjects(void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<DirEntry> dirContents;
|
std::vector<DirEntry> dirContents;
|
||||||
uint selectedFile = 0;
|
mutable int screenPos = 0;
|
||||||
|
mutable int selection = 0;
|
||||||
int keyRepeatDelay = 0;
|
int keyRepeatDelay = 0;
|
||||||
int fastMode = false;
|
int fastMode = false;
|
||||||
bool dirChanged = true;
|
bool dirChanged = true;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ Info parseInfo(std::string fileName) {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<Info> fileInfo;
|
std::vector<Info> fileInfo;
|
||||||
|
|
||||||
ScriptList::ScriptList() {
|
ScriptList::ScriptList() {
|
||||||
@@ -69,21 +70,61 @@ ScriptList::ScriptList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScriptList::Draw(void) const {
|
void ScriptList::Draw(void) const {
|
||||||
std::string titleinfo;
|
std::string titleinfo;
|
||||||
Gui::DrawTop();
|
Gui::DrawTop();
|
||||||
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, "Universal-Updater", 400);
|
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, "Universal-Updater", 400);
|
||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
||||||
titleinfo = fileInfo[i].title + '\n' + fileInfo[i].description;
|
titleinfo = fileInfo[screenPos + i].title + '\n' + fileInfo[screenPos + i].description;
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, TopBGColor);
|
if(screenPos + i == selection) {
|
||||||
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, SelectedColor);
|
||||||
|
} else {
|
||||||
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, UnselectedColor);
|
||||||
|
}
|
||||||
Gui::DrawString(0, 40+(i*57), 0.7f, WHITE, titleinfo, 320);
|
Gui::DrawString(0, 40+(i*57), 0.7f, WHITE, titleinfo, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
Gui::screenBack();
|
Gui::screenBack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hHeld & KEY_DOWN && !keyRepeatDelay) {
|
||||||
|
if (selection < (int)fileInfo.size()-1) {
|
||||||
|
selection++;
|
||||||
|
} else {
|
||||||
|
selection = 0;
|
||||||
|
}
|
||||||
|
if (fastMode == true) {
|
||||||
|
keyRepeatDelay = 3;
|
||||||
|
} else if (fastMode == false){
|
||||||
|
keyRepeatDelay = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hHeld & KEY_UP && !keyRepeatDelay) {
|
||||||
|
if (selection > 0) {
|
||||||
|
selection--;
|
||||||
|
} else {
|
||||||
|
selection = (int)fileInfo.size()-1;
|
||||||
|
}
|
||||||
|
if (fastMode == true) {
|
||||||
|
keyRepeatDelay = 3;
|
||||||
|
} else if (fastMode == false){
|
||||||
|
keyRepeatDelay = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selection < screenPos) {
|
||||||
|
screenPos = selection;
|
||||||
|
} else if (selection > screenPos + ENTRIES_PER_SCREEN - 1) {
|
||||||
|
screenPos = selection - ENTRIES_PER_SCREEN + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user