mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +00:00
my latest work.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
sprites/arrow.png
|
||||
sprites/bottom_screen_bot.png
|
||||
sprites/bottom_screen_top.png
|
||||
sprites/download_all.png
|
||||
sprites/top_screen_bot.png
|
||||
sprites/top_screen_top.png
|
||||
sprites/search.png
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 723 B |
Binary file not shown.
|
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 10 KiB |
+1
-1
@@ -46,7 +46,7 @@ namespace Gui
|
||||
|
||||
// Draw a Sprite from the sheet.
|
||||
void sprite(int key, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
|
||||
void spriteBlend(int key, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
void DrawArrow(int x, int y, float rotation = 0);
|
||||
|
||||
// Misc.
|
||||
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
{295, 0, 25, 25, -1}, // Arrow Up.
|
||||
{295, 215, 25, 25, -1}, // Arrow Down.
|
||||
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||
{0, 0, 25, 25, -1}, // Download All.
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+32
-1
@@ -91,13 +91,44 @@ void Gui::sprite(int key, int x, int y, float ScaleX, float ScaleY)
|
||||
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, NULL, ScaleX, ScaleY);
|
||||
}
|
||||
|
||||
void Gui::spriteBlend(int key, int x, int y, float ScaleX, float ScaleY)
|
||||
{
|
||||
C2D_ImageTint tint;
|
||||
if (isScriptSelected) {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
||||
} else {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, Config::TxtColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
|
||||
}
|
||||
|
||||
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, &tint, ScaleX, ScaleY);
|
||||
}
|
||||
|
||||
void Gui::DrawArrow(int x, int y, float rotation) {
|
||||
C2D_Sprite sprite;
|
||||
C2D_ImageTint tint;
|
||||
if (isScriptSelected) {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
|
||||
} else {
|
||||
C2D_SetImageTint(&tint, C2D_TopLeft, Config::TxtColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
|
||||
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
|
||||
}
|
||||
|
||||
C2D_SpriteFromSheet(&sprite, sprites, sprites_arrow_idx);
|
||||
C2D_SpriteRotateDegrees(&sprite, rotation);
|
||||
C2D_SpriteSetPos(&sprite, x, y);
|
||||
C2D_SpriteSetDepth(&sprite, 0.5);
|
||||
C2D_DrawSprite(&sprite);
|
||||
C2D_DrawSpriteTinted(&sprite, &tint);
|
||||
}
|
||||
|
||||
void Gui::DisplayWarnMsg(std::string Text)
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ std::string Input::Numpad(uint maxLength, std::string Text)
|
||||
C2D_TargetClear(bottom, BLACK);
|
||||
Gui::DrawTop();
|
||||
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, WHITE, Text, 400);
|
||||
Gui::DrawString(180, 212, 0.8, WHITE, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
|
||||
Gui::DrawString(180, 217, 0.8, WHITE, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
|
||||
if(cursorBlink < -20) cursorBlink = 20;
|
||||
Gui::setDraw(bottom);
|
||||
Gui::Draw_Rect(0, 0, 320, 240, Config::Color3);
|
||||
|
||||
@@ -126,11 +126,11 @@ void ScriptBrowse::Draw(void) const {
|
||||
Gui::DrawStringCentered(0, 217, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 400);
|
||||
}
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(295, 0);
|
||||
Gui::DrawArrow(315, 240, 180.0);
|
||||
// Gui::sprite(sprites_search_idx, -3, 0);
|
||||
// Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
|
||||
|
||||
Gui::DrawArrow(295, -3);
|
||||
Gui::DrawArrow(315, 242, 180.0);
|
||||
// Gui::spriteBlend(sprites_search_idx, -3, 0, Config::TxtColor);
|
||||
// Gui::DrawString(7.5, 1.5, 0.72f, Config::TxtColor, "\uE003");
|
||||
Gui::spriteBlend(sprites_download_all_idx, 0, 0);
|
||||
Gui::DrawArrow(0, 242, 270.0);
|
||||
Gui::DrawStringCentered(-23, 3, 0.6f, Config::TxtColor, std::to_string(selection + 1) + " / " + maxScripts);
|
||||
|
||||
@@ -228,11 +228,11 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
if (infoJson.size() != 0) {
|
||||
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPos + i]["title"]);
|
||||
std::string titleFix = infoJson[screenPos + i]["title"];
|
||||
for (int l = 0; i < (int)titleFix.size(); l++) {
|
||||
for (int l = 0; l < (int)titleFix.size(); l++) {
|
||||
if (titleFix[l] == '/') {
|
||||
titleFix[l] = '-';
|
||||
}
|
||||
@@ -328,4 +328,23 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH && touching(touch, arrowPos[3])) {
|
||||
if (infoJson.size() != 0) {
|
||||
for (int i = 0; i < (int)infoJson.size(); i++) {
|
||||
int current = i+1;
|
||||
int total = infoJson.size();
|
||||
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[i]["title"]);
|
||||
std::string titleFix = infoJson[i]["title"];
|
||||
for (int l = 0; l < (int)titleFix.size(); l++) {
|
||||
if (titleFix[l] == '/') {
|
||||
titleFix[l] = '-';
|
||||
}
|
||||
}
|
||||
DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
|
||||
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
|
||||
infoJson[i]["curRevision"] = infoJson[i]["revision"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,8 +284,8 @@ void ScriptList::DrawList(void) const {
|
||||
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(fileInfo[selection].shortDesc), 400);
|
||||
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(295, 0);
|
||||
Gui::DrawArrow(315, 240, 180.0);
|
||||
Gui::DrawArrow(295, -3);
|
||||
Gui::DrawArrow(315, 242, 180.0);
|
||||
Gui::DrawArrow(0, 242, 270.0);
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
||||
@@ -339,8 +339,8 @@ void ScriptList::DrawSingleObject(void) const {
|
||||
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
|
||||
}
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(295, 0);
|
||||
Gui::DrawArrow(315, 240, 180.0);
|
||||
Gui::DrawArrow(295, -3);
|
||||
Gui::DrawArrow(315, 242, 180.0);
|
||||
Gui::DrawArrow(0, 242, 270.0);
|
||||
|
||||
if (Config::viewMode == 0) {
|
||||
@@ -400,8 +400,8 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN; i++) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
if (dirContents[screenPos + i].isDirectory) {
|
||||
} else if (fileInfo.size() != 0) {
|
||||
if (ScriptHelper::checkIfValid(dirContents[screenPos + i].name) == true) {
|
||||
@@ -418,11 +418,11 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
mode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Config::viewMode == 1) {
|
||||
for(int i=0;i<ENTRIES_PER_LIST;i++) {
|
||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||
for(int i=0;i<ENTRIES_PER_LIST; i++) {
|
||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||
if (dirContents[screenPosList + i].isDirectory) {
|
||||
} else if (fileInfo.size() != 0) {
|
||||
if (ScriptHelper::checkIfValid(dirContents[screenPosList + i].name) == true) {
|
||||
@@ -439,7 +439,7 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
mode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -538,22 +538,22 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN; i++) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
if (fileInfo2.size() != 0) {
|
||||
choice = fileInfo2[screenPos2 + i];
|
||||
runFunctions(jsonFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Config::viewMode == 1) {
|
||||
for(int i=0;i<ENTRIES_PER_LIST;i++) {
|
||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||
for(int i=0;i<ENTRIES_PER_LIST; i++) {
|
||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||
if (fileInfo2.size() != 0) {
|
||||
choice = fileInfo2[screenPosList2 + i];
|
||||
runFunctions(jsonFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+36
-34
@@ -73,14 +73,14 @@ std::vector<std::string> tinyDBList;
|
||||
TinyDB::TinyDB() {
|
||||
DisplayMsg(Lang::get("TINYDB_DOWNLOADING"));
|
||||
downloadToFile("https://tinydb.eiphax.tech/api/universal-updater.json?raw=true", tinyDBFile);
|
||||
tinyDBList = parseObjects();
|
||||
tinyDBList = parseObjects();
|
||||
selectedOption = tinyDBList[0];
|
||||
}
|
||||
|
||||
// To-Do.
|
||||
void TinyDB::Draw(void) const {
|
||||
std::string info;
|
||||
Gui::setDraw(top);
|
||||
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));
|
||||
@@ -93,40 +93,42 @@ 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, 2, 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), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
Gui::DrawStringCentered(0, 2, 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), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
|
||||
|
||||
Gui::setDraw(bottom);
|
||||
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);
|
||||
|
||||
Gui::DrawArrow(295, 0);
|
||||
Gui::DrawArrow(315, 240, 180.0);
|
||||
Gui::DrawArrow(295, -3);
|
||||
Gui::DrawArrow(315, 242, 180.0);
|
||||
Gui::DrawArrow(0, 242, 270.0);
|
||||
// Search Icon.
|
||||
// Search Icon.
|
||||
// Gui::sprite(sprites_search_idx, -3, 0);
|
||||
// Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
|
||||
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)tinyDBList.size();i++) {
|
||||
info = tinyDBList[screenPos + i];
|
||||
if(screenPos + i == selection) {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, C2D_Color32(120, 192, 216, 255));
|
||||
} else {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, C2D_Color32(77, 118, 132, 255));
|
||||
}
|
||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, info, 320);
|
||||
}
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)tinyDBList.size();i++) {
|
||||
info = tinyDBList[screenPos + i];
|
||||
if(screenPos + i == selection) {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, C2D_Color32(120, 192, 216, 255));
|
||||
} else {
|
||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, C2D_Color32(77, 118, 132, 255));
|
||||
}
|
||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, info, 320);
|
||||
}
|
||||
} else if (Config::viewMode == 1) {
|
||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)tinyDBList.size();i++) {
|
||||
info = tinyDBList[screenPosList + i];
|
||||
if(screenPosList + i == selection) {
|
||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::SelectedColor);
|
||||
} else {
|
||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
||||
}
|
||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, info, 320);
|
||||
}
|
||||
@@ -134,11 +136,11 @@ void TinyDB::Draw(void) const {
|
||||
}
|
||||
|
||||
void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (keyRepeatDelay) keyRepeatDelay--;
|
||||
if (hDown & KEY_B) {
|
||||
Screen::back();
|
||||
return;
|
||||
}
|
||||
if (keyRepeatDelay) keyRepeatDelay--;
|
||||
if (hDown & KEY_B) {
|
||||
Screen::back();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hDown & KEY_R) {
|
||||
fastMode = true;
|
||||
@@ -169,8 +171,8 @@ void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
|
||||
Screen::back();
|
||||
return;
|
||||
Screen::back();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hHeld & KEY_UP && !keyRepeatDelay) {
|
||||
@@ -228,26 +230,26 @@ void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (Config::viewMode == 0) {
|
||||
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
if(touch.py > (i+1)*57 && touch.py < (i+2)*57) {
|
||||
selection = screenPos + i;
|
||||
selectedOption = tinyDBList[screenPos + i];
|
||||
execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Config::viewMode == 1) {
|
||||
for(int i=0;i<ENTRIES_PER_LIST;i++) {
|
||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||
selection = screenPosList + i;
|
||||
selectedOption = tinyDBList[screenPosList + i];
|
||||
execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_A) {
|
||||
execute();
|
||||
}
|
||||
if (hDown & KEY_A) {
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
void TinyDB::execute() {
|
||||
|
||||
Reference in New Issue
Block a user