mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
See desc for more.
- Added option, to have a 400x214px custom Image as the Background on a UniStore. - Added a header bar on almost all menus. - Added GUI Settings.
This commit is contained in:
+13
-10
@@ -28,17 +28,16 @@
|
||||
#include "storeUtils.hpp"
|
||||
#include "structs.hpp"
|
||||
|
||||
#define DOWNLOAD_ENTRIES 8
|
||||
#define DOWNLOAD_ENTRIES 7
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
static const std::vector<Structs::ButtonPos> downloadBoxes = {
|
||||
{ 54, 4, 262, 22 },
|
||||
{ 54, 34, 262, 22 },
|
||||
{ 54, 64, 262, 22 },
|
||||
{ 54, 94, 262, 22 },
|
||||
{ 54, 124, 262, 22 },
|
||||
{ 54, 154, 262, 22 },
|
||||
{ 54, 184, 262, 22 },
|
||||
{ 54, 214, 262, 22 }
|
||||
{ 54, 32, 262, 22 },
|
||||
{ 54, 62, 262, 22 },
|
||||
{ 54, 92, 262, 22 },
|
||||
{ 54, 122, 262, 22 },
|
||||
{ 54, 152, 262, 22 },
|
||||
{ 54, 182, 262, 22 },
|
||||
{ 54, 212, 262, 22 }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -50,6 +49,10 @@ static const std::vector<Structs::ButtonPos> downloadBoxes = {
|
||||
*/
|
||||
void StoreUtils::DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, const bool &fetch) {
|
||||
if (store && !fetch) {
|
||||
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("AVAILABLE_DOWNLOADS"), 265);
|
||||
|
||||
if (entries.size() > 0) {
|
||||
for (int i = 0; i < DOWNLOAD_ENTRIES && i < (int)entries.size(); i++) {
|
||||
if (store->GetDownloadIndex() == i + store->GetDownloadSIndex()) GFX::DrawBox(downloadBoxes[i].x, downloadBoxes[i].y, downloadBoxes[i].w, downloadBoxes[i].h, false);
|
||||
@@ -57,7 +60,7 @@ void StoreUtils::DrawDownList(const std::unique_ptr<Store> &store, const std::ve
|
||||
}
|
||||
|
||||
} else { // If no downloads available..
|
||||
Gui::DrawStringCentered(25, downloadBoxes[0].y + 4, 0.5f, TEXT_COLOR, Lang::get("NO_DOWNLOADS_AVAILABLE"), 255);
|
||||
Gui::DrawStringCentered(54 - 160 + (262 / 2), downloadBoxes[0].y + 4, 0.5f, TEXT_COLOR, Lang::get("NO_DOWNLOADS_AVAILABLE"), 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,14 @@ static const std::vector<Structs::ButtonPos> GridBoxes = {
|
||||
*/
|
||||
void StoreUtils::DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries) {
|
||||
if (store) { // Ensure, store is not a nullptr.
|
||||
|
||||
if (config->usebg() && store->customBG()) {
|
||||
C2D_DrawImageAt(store->GetStoreImg(), 0, 26, 0.5f, nullptr);
|
||||
|
||||
} else {
|
||||
Gui::Draw_Rect(0, 26, 400, 214, BG_COLOR);
|
||||
}
|
||||
|
||||
for (int i = 0, i2 = 0 + (store->GetScreenIndx() * 5); i2 < 15 + (store->GetScreenIndx() * 5) && i2 < (int)entries.size(); i2++, i++) {
|
||||
|
||||
/* Boxes. */
|
||||
|
||||
@@ -41,6 +41,14 @@ static const std::vector<Structs::ButtonPos> StoreBoxesList = {
|
||||
*/
|
||||
void StoreUtils::DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries) {
|
||||
if (store) { // Ensure, store is not a nullptr.
|
||||
|
||||
if (config->usebg() && store->customBG()) {
|
||||
C2D_DrawImageAt(store->GetStoreImg(), 0, 26, 0.5f, nullptr);
|
||||
|
||||
} else {
|
||||
Gui::Draw_Rect(0, 26, 400, 214, BG_COLOR);
|
||||
}
|
||||
|
||||
if (entries.size() > 0) {
|
||||
for (int i = 0; i < 3 && i < (int)entries.size(); i++) {
|
||||
|
||||
|
||||
+27
-17
@@ -30,21 +30,21 @@
|
||||
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
static const std::vector<Structs::ButtonPos> SearchMenu = {
|
||||
{ 55, 5, 258, 30 }, // Search bar.
|
||||
{ 55, 45, 258, 30 }, // Search bar.
|
||||
|
||||
/* Includes. */
|
||||
{ 85, 84, 10, 10 },
|
||||
{ 85, 100, 10, 10 },
|
||||
{ 167, 84, 10, 10 },
|
||||
{ 167, 100, 10, 10 },
|
||||
{ 85, 109, 50, 10 },
|
||||
{ 85, 125, 50, 10 },
|
||||
{ 167, 109, 50, 10 },
|
||||
{ 167, 125, 50, 10 },
|
||||
|
||||
/* Filters. */
|
||||
{ 82, 170, 30, 30 },
|
||||
{ 117, 170, 30, 30 },
|
||||
{ 152, 170, 30, 30 },
|
||||
{ 187, 170, 30, 30 },
|
||||
{ 222, 170, 30, 30 },
|
||||
{ 257, 170, 30, 30 }
|
||||
{ 82, 195, 30, 30 },
|
||||
{ 117, 195, 30, 30 },
|
||||
{ 152, 195, 30, 30 },
|
||||
{ 187, 195, 30, 30 },
|
||||
{ 222, 195, 30, 30 },
|
||||
{ 257, 195, 30, 30 }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -56,17 +56,21 @@ static const std::vector<Structs::ButtonPos> SearchMenu = {
|
||||
const bool &updateFilter: Const Reference to the update filter.
|
||||
*/
|
||||
void StoreUtils::DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter) {
|
||||
Gui::Draw_Rect(54, 4, 260, SearchMenu[0].h + 2, SEARCH_BAR_OUTL_COLOR);
|
||||
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SEARCH_FILTERS"), 265);
|
||||
|
||||
Gui::Draw_Rect(54, 44, 260, SearchMenu[0].h + 2, SEARCH_BAR_OUTL_COLOR);
|
||||
Gui::Draw_Rect(SearchMenu[0].x, SearchMenu[0].y, SearchMenu[0].w, SearchMenu[0].h, SEARCH_BAR_COLOR);
|
||||
|
||||
Gui::DrawStringCentered(28, 10, 0.6, TEXT_COLOR, searchResult, 265);
|
||||
Gui::DrawStringCentered(28, 50, 0.6, TEXT_COLOR, searchResult, 265);
|
||||
|
||||
/* Checkboxes. */
|
||||
for (int i = 0; i < 4; i++) {
|
||||
GFX::DrawCheckbox(SearchMenu[i + 1].x, SearchMenu[i + 1].y, searchIncludes[i]);
|
||||
}
|
||||
|
||||
Gui::DrawString(84, 60, 0.5, TEXT_COLOR, Lang::get("INCLUDE_IN_RESULTS"), 265);
|
||||
Gui::DrawString(84, 85, 0.5, TEXT_COLOR, Lang::get("INCLUDE_IN_RESULTS"), 265);
|
||||
|
||||
Gui::DrawString(SearchMenu[1].x + 18, SearchMenu[1].y + 1, 0.4, TEXT_COLOR, Lang::get("TITLE"), 90);
|
||||
Gui::DrawString(SearchMenu[2].x + 18, SearchMenu[2].y + 1, 0.4, TEXT_COLOR, Lang::get("AUTHOR"), 90);
|
||||
@@ -75,7 +79,7 @@ void StoreUtils::DrawSearchMenu(const std::vector<bool> &searchIncludes, const s
|
||||
Gui::DrawString(SearchMenu[4].x + 18, SearchMenu[4].y + 1, 0.4, TEXT_COLOR, Lang::get("CONSOLE"), 90);
|
||||
|
||||
/* Filters. */
|
||||
Gui::DrawString(84, 150, 0.5f, TEXT_COLOR, Lang::get("FILTER_TO"), 265);
|
||||
Gui::DrawString(84, 175, 0.5f, TEXT_COLOR, Lang::get("FILTER_TO"), 265);
|
||||
|
||||
Gui::Draw_Rect(SearchMenu[5].x, SearchMenu[5].y, SearchMenu[5].w, SearchMenu[5].h, (marks & favoriteMarks::STAR ?
|
||||
SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
|
||||
@@ -139,8 +143,14 @@ void StoreUtils::SearchHandle(u32 hDown, u32 hHeld, touchPosition touch, std::un
|
||||
/* Search bar. */
|
||||
if (!didTouch) {
|
||||
if (touching(touch, SearchMenu[0])) {
|
||||
searchResult = Input::setkbdString(20, Lang::get("ENTER_SEARCH"));
|
||||
didTouch = true;
|
||||
if (store) {
|
||||
searchResult = Input::setkbdString(20, Lang::get("ENTER_SEARCH"), {});
|
||||
didTouch = true;
|
||||
|
||||
} else {
|
||||
searchResult = Input::setkbdString(20, Lang::get("ENTER_SEARCH"), {});
|
||||
didTouch = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+122
-32
@@ -30,13 +30,13 @@
|
||||
extern bool exiting;
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
static const std::vector<Structs::ButtonPos> mainButtons = {
|
||||
{ 54, 4, 262, 22 },
|
||||
{ 54, 34, 262, 22 },
|
||||
{ 54, 64, 262, 22 },
|
||||
{ 54, 94, 262, 22 },
|
||||
{ 54, 124, 262, 22 },
|
||||
{ 54, 154, 262, 22 },
|
||||
{ 54, 184, 262, 22 }
|
||||
{ 54, 32, 262, 22 },
|
||||
{ 54, 62, 262, 22 },
|
||||
{ 54, 92, 262, 22 },
|
||||
{ 54, 122, 262, 22 },
|
||||
{ 54, 152, 262, 22 },
|
||||
{ 54, 182, 262, 22 },
|
||||
{ 54, 212, 262, 22 }
|
||||
};
|
||||
|
||||
static const std::vector<Structs::ButtonPos> toggleAbles = {
|
||||
@@ -45,8 +45,10 @@ static const std::vector<Structs::ButtonPos> toggleAbles = {
|
||||
{ 288, 140, 24, 24 }
|
||||
};
|
||||
|
||||
static const Structs::ButtonPos back = { 52, 0, 24, 24 }; // Back arrow for directory.
|
||||
|
||||
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "CHANGE_DIRECTORIES", "CREDITS", "EXIT_APP" };
|
||||
|
||||
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
|
||||
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH" };
|
||||
|
||||
/*
|
||||
@@ -55,7 +57,11 @@ static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE
|
||||
const int &selection: Const Reference to the Settings Selection.
|
||||
*/
|
||||
static void DrawSettingsMain(const int &selection) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SETTINGS"), 265);
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false);
|
||||
Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(mainStrings[i]), 255);
|
||||
}
|
||||
@@ -67,6 +73,11 @@ static void DrawSettingsMain(const int &selection) {
|
||||
const int &selection: Const Reference to the Settings Selection.
|
||||
*/
|
||||
static void DrawSettingsDir(const int &selection) {
|
||||
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
GFX::DrawSprite(sprites_arrow_idx, back.x, back.y);
|
||||
Gui::DrawStringCentered(32, 2, 0.6, TEXT_COLOR, Lang::get("DIRECTORY_SETTINGS"), 240);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false);
|
||||
Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(dirStrings[i]), 255);
|
||||
@@ -76,7 +87,7 @@ static void DrawSettingsDir(const int &selection) {
|
||||
/*
|
||||
Draw Auto-Update Settings page.
|
||||
*/
|
||||
static void DrawAutoUpdate() {
|
||||
static void DrawAutoUpdate(const int &selection) {
|
||||
Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
GFX::DrawSprite(sprites_arrow_idx, 52, 6);
|
||||
@@ -84,17 +95,30 @@ static void DrawAutoUpdate() {
|
||||
Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("AUTO_UPDATE_SETTINGS"), 240);
|
||||
|
||||
/* Toggle Boxes. */
|
||||
GFX::DrawBox(48, 64, 273, 24, false);
|
||||
Gui::Draw_Rect(48, 64, 273, 24, (selection == 0 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
|
||||
Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE"), 210);
|
||||
GFX::DrawToggle(288, 64, config->autoupdate());
|
||||
Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE_DESC"), 265, 0, nullptr, C2D_WordWrap);
|
||||
|
||||
GFX::DrawBox(48, 140, 273, 24, false);
|
||||
Gui::Draw_Rect(48, 140, 273, 24, (selection == 1 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
|
||||
Gui::DrawString(55, 144, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU"), 210);
|
||||
GFX::DrawToggle(288, 140, config->updatecheck());
|
||||
Gui::DrawString(55, 171, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU_DESC"), 265, 0, nullptr, C2D_WordWrap);
|
||||
}
|
||||
|
||||
static void DrawGUISettings(const int &selection) {
|
||||
Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
GFX::DrawSprite(sprites_arrow_idx, 52, 6);
|
||||
|
||||
Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("GUI_SETTINGS"), 240);
|
||||
|
||||
Gui::Draw_Rect(48, 64, 273, 24, (selection == 0 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
|
||||
Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("UNISTORE_BG"), 210);
|
||||
GFX::DrawToggle(288, 64, config->usebg());
|
||||
Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("UNISTORE_BG_DESC"), 265, 0, nullptr, C2D_WordWrap);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Settings Main Handle.
|
||||
@@ -124,7 +148,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
if (selection < 5) selection++;
|
||||
if (selection < 6) selection++;
|
||||
else selection = 0;
|
||||
}
|
||||
|
||||
@@ -145,7 +169,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, mainButtons[0])) {
|
||||
Overlays::SelectLanguage();
|
||||
Overlays::SelectLanguage(store);
|
||||
|
||||
} else if (touching(touch, mainButtons[1])) {
|
||||
Overlays::SelectStore(store, entries, meta);
|
||||
@@ -155,13 +179,17 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
page = 2;
|
||||
|
||||
} else if (touching(touch, mainButtons[3])) {
|
||||
selection = 0;
|
||||
page = 3;
|
||||
|
||||
} else if (touching(touch, mainButtons[4])) {
|
||||
selection = 0;
|
||||
page = 1;
|
||||
|
||||
} else if (touching(touch, mainButtons[4])) {
|
||||
} else if (touching(touch, mainButtons[5])) {
|
||||
Overlays::ShowCredits();
|
||||
|
||||
} else if (touching(touch, mainButtons[5])) {
|
||||
} else if (touching(touch, mainButtons[6])) {
|
||||
exiting = true;
|
||||
}
|
||||
}
|
||||
@@ -169,7 +197,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
if (hDown & KEY_A) {
|
||||
switch(selection) {
|
||||
case 0:
|
||||
Overlays::SelectLanguage();
|
||||
Overlays::SelectLanguage(store);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -183,14 +211,19 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
|
||||
case 3:
|
||||
selection = 0;
|
||||
page = 1;
|
||||
page = 3;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Overlays::ShowCredits();
|
||||
selection = 0;
|
||||
page = 1;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Overlays::ShowCredits();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
exiting = true;
|
||||
break;
|
||||
}
|
||||
@@ -210,10 +243,10 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
|
||||
int &page: Reference to the page.
|
||||
int &selection: Reference to the Selection.
|
||||
*/
|
||||
static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) {
|
||||
static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, const std::unique_ptr<Store> &store) {
|
||||
if (hDown & KEY_B) {
|
||||
page = 0;
|
||||
selection = 3;
|
||||
selection = 4;
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
@@ -237,16 +270,20 @@ static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &pa
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, mainButtons[0])) {
|
||||
const std::string path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"));
|
||||
if (touching(touch, back)) {
|
||||
page = 0;
|
||||
selection = 4;
|
||||
|
||||
} else if (touching(touch, mainButtons[0])) {
|
||||
const std::string path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->_3dsxPath(path);
|
||||
|
||||
} else if (touching(touch, mainButtons[1])) {
|
||||
const std::string path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"));
|
||||
const std::string path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->ndsPath(path);
|
||||
|
||||
} else if (touching(touch, mainButtons[2])) {
|
||||
const std::string path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"));
|
||||
const std::string path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->archPath(path);
|
||||
}
|
||||
}
|
||||
@@ -256,29 +293,37 @@ static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &pa
|
||||
|
||||
switch(selection) {
|
||||
case 0:
|
||||
path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"));
|
||||
path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->_3dsxPath(path);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"));
|
||||
path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->ndsPath(path);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"));
|
||||
path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
|
||||
if (path != "") config->archPath(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SettingsToggleLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) {
|
||||
static void AutoUpdateLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) {
|
||||
if (hDown & KEY_B) {
|
||||
page = 0;
|
||||
selection = 2;
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_DOWN) {
|
||||
if (selection < 1) selection++;
|
||||
}
|
||||
|
||||
if (hRepeat & KEY_UP) {
|
||||
if (selection > 0) selection--;
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, toggleAbles[0])) {
|
||||
page = 0;
|
||||
@@ -291,6 +336,43 @@ static void SettingsToggleLogic(u32 hDown, u32 hHeld, touchPosition touch, int &
|
||||
config->updatecheck(!config->updatecheck());
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_A) {
|
||||
switch(selection) {
|
||||
case 0:
|
||||
config->autoupdate(!config->autoupdate());
|
||||
break;
|
||||
|
||||
case 1:
|
||||
config->updatecheck(!config->updatecheck());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void GUISettingsLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, const std::unique_ptr<Store> &store) {
|
||||
if (hDown & KEY_B) {
|
||||
page = 0;
|
||||
selection = 3;
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, toggleAbles[0])) {
|
||||
page = 0;
|
||||
selection = 3;
|
||||
|
||||
} else if (touching(touch, toggleAbles[1])) {
|
||||
config->usebg(!config->usebg());
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_A) {
|
||||
switch(selection) {
|
||||
case 0:
|
||||
config->usebg(!config->usebg());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -310,7 +392,11 @@ void StoreUtils::DrawSettings(const int &page, const int &selection) {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
DrawAutoUpdate();
|
||||
DrawAutoUpdate(selection);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
DrawGUISettings(selection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -336,11 +422,15 @@ void StoreUtils::SettingsHandle(u32 hDown, u32 hHeld, touchPosition touch, int &
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SettingsHandleDir(hDown, hHeld, touch, page, selection);
|
||||
SettingsHandleDir(hDown, hHeld, touch, page, selection, store);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SettingsToggleLogic(hDown, hHeld, touch, page, selection);
|
||||
AutoUpdateLogic(hDown, hHeld, touch, page, selection);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
GUISettingsLogic(hDown, hHeld, touch, page, selection, store);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -31,15 +31,15 @@
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
|
||||
static const std::vector<Structs::ButtonPos> buttons = {
|
||||
{ 75, 50, 100, 16 },
|
||||
{ 75, 70, 100, 16 },
|
||||
{ 75, 90, 100, 16 },
|
||||
{ 75, 60, 100, 16 },
|
||||
{ 75, 80, 100, 16 },
|
||||
{ 75, 100, 100, 16 },
|
||||
|
||||
{ 205, 50, 100, 16 },
|
||||
{ 205, 70, 100, 16 },
|
||||
{ 205, 60, 100, 16 },
|
||||
{ 205, 80, 100, 16 },
|
||||
|
||||
{ 75, 160, 100, 16 },
|
||||
{ 75, 180, 100, 16 }
|
||||
{ 75, 170, 100, 16 },
|
||||
{ 75, 190, 100, 16 }
|
||||
};
|
||||
|
||||
static void DrawCheck(int pos, bool v) {
|
||||
@@ -73,6 +73,10 @@ static const uint8_t GetType(const SortType &st) {
|
||||
const SortType &st: Const Reference to the SortType variable.
|
||||
*/
|
||||
void StoreUtils::DrawSorting(const bool &asc, const SortType &st) {
|
||||
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
|
||||
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
|
||||
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SORTING"), 265);
|
||||
|
||||
/* Sort By. */
|
||||
Gui::DrawString(buttons[0].x + 5, buttons[0].y - 20, 0.6f, TEXT_COLOR, Lang::get("SORT_BY"), 90);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
+35
-1
@@ -40,7 +40,10 @@ static bool firstStart = true;
|
||||
|
||||
const std::string &file: The UniStore file.
|
||||
*/
|
||||
Store::Store(const std::string &file) { this->update(file); };
|
||||
Store::Store(const std::string &file) {
|
||||
this->update(file);
|
||||
this->SetC2DBGImage();
|
||||
};
|
||||
|
||||
/*
|
||||
Update an UniStore,, including SpriteSheet, if revision increased.
|
||||
@@ -409,6 +412,37 @@ C2D_Image Store::GetIconEntry(const int &index) const {
|
||||
return C2D_SpriteSheetGetImage(sprites, sprites_noIcon_idx);
|
||||
}
|
||||
|
||||
/*
|
||||
Set's the custom BG to the storeBG variable.
|
||||
*/
|
||||
void Store::SetC2DBGImage() {
|
||||
if (!this->valid) return;
|
||||
if (this->sheets.empty()) return;
|
||||
int index = -1, sheetIndex = -1;
|
||||
|
||||
if (this->storeJson["storeInfo"].contains("bg_index") && this->storeJson["storeInfo"]["bg_index"].is_number()) {
|
||||
index = this->storeJson["storeInfo"]["bg_index"];
|
||||
}
|
||||
|
||||
if (this->storeJson["storeInfo"].contains("bg_sheet") && this->storeJson["storeInfo"]["bg_sheet"].is_number()) {
|
||||
sheetIndex = this->storeJson["storeInfo"]["bg_sheet"];
|
||||
}
|
||||
|
||||
if (index == -1 || sheetIndex == -1) return;
|
||||
|
||||
if (sheetIndex > (int)this->sheets.size()) return;
|
||||
if (!this->sheets[sheetIndex]) return;
|
||||
|
||||
if (index > (int)C2D_SpriteSheetCount(this->sheets[sheetIndex])-1) return;
|
||||
|
||||
C2D_Image temp = C2D_SpriteSheetGetImage(this->sheets[sheetIndex], index);
|
||||
|
||||
if (temp.subtex->width == 400 && temp.subtex->height == 214) {
|
||||
this->hasCustomBG = true;
|
||||
this->storeBG = temp; // Must be 400x214.
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Return the download list of an entry.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user