mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Also add Custom Themes to this branch.
I mean, cause why not i guess. xD
This commit is contained in:
+4
-27
@@ -29,46 +29,23 @@
|
||||
|
||||
#include "common.hpp"
|
||||
#include "sprites.h"
|
||||
#include "theme.hpp"
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
extern std::unique_ptr<Theme> UIThemes;
|
||||
|
||||
/* Standard Colors. */
|
||||
#define WHITE C2D_Color32(255, 255, 255, 255)
|
||||
#define BLACK C2D_Color32(0, 0, 0, 255)
|
||||
#define TRANSPARENT C2D_Color32(0, 0, 0, 0)
|
||||
#define DIM_COLOR C2D_Color32(0, 0, 0, 190)
|
||||
|
||||
struct UITheme {
|
||||
uint32_t BarColor;
|
||||
uint32_t BGColor;
|
||||
uint32_t BarOutline;
|
||||
uint32_t TextColor;
|
||||
uint32_t EntryBar;
|
||||
uint32_t EntryOutline;
|
||||
uint32_t BoxInside;
|
||||
uint32_t BoxSelected;
|
||||
uint32_t BoxUnselected;
|
||||
uint32_t ProgressbarOut;
|
||||
uint32_t ProgressbarIn;
|
||||
uint32_t SearchBar;
|
||||
uint32_t SearchbarOutline;
|
||||
uint32_t SideBarSelected;
|
||||
uint32_t SideBarUnselected;
|
||||
/* NOTE: Also used for the buttons. */
|
||||
uint32_t MarkSelected;
|
||||
uint32_t MarkUnselected;
|
||||
uint32_t DownListPrev;
|
||||
uint32_t SideBarIconColor;
|
||||
};
|
||||
|
||||
namespace GFX {
|
||||
extern std::vector<UITheme> Themes;
|
||||
extern int SelectedTheme;
|
||||
|
||||
void DrawTop(void);
|
||||
void DrawBottom();
|
||||
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
void DrawBox(float xPos, float yPos, float width = 50, float height = 50, bool selected = false, uint32_t clr = GFX::Themes[GFX::SelectedTheme].BoxInside);
|
||||
void DrawBox(float xPos, float yPos, float width = 50, float height = 50, bool selected = false, uint32_t clr = UIThemes->BoxInside());
|
||||
void DrawCheckbox(float xPos, float yPos, bool selected);
|
||||
void DrawToggle(float xPos, float yPos, bool toggled);
|
||||
void DrawTime();
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Overlays {
|
||||
void SelectLanguage();
|
||||
void ShowCredits();
|
||||
std::string SelectDir(const std::string &oldDir, const std::string &msg);
|
||||
void SelectTheme();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -95,8 +95,8 @@ public:
|
||||
void changelog(bool v) { this->v_changelog = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* The active Theme. */
|
||||
int theme() const { return this->v_theme; };
|
||||
void theme(int v) { this->v_theme = v; if (!this->changesMade) this->changesMade = true; };
|
||||
std::string theme() const { return this->v_theme; };
|
||||
void theme(const std::string &v) { this->v_theme = v; if (!this->changesMade) this->changesMade = true; };
|
||||
|
||||
/* If showing prompt if action failed / succeeded. */
|
||||
bool prompt() const { return this->v_prompt; };
|
||||
@@ -113,11 +113,9 @@ private:
|
||||
nlohmann::json json;
|
||||
bool changesMade = false;
|
||||
|
||||
int v_theme = 0;
|
||||
|
||||
std::string v_language = "en", v_lastStore = "universal-db.unistore",
|
||||
v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:",
|
||||
v_shortcutPath = "sdmc:/3ds/Universal-Updater/shortcuts", v_firmPath = "sdmc:/luma/payloads";
|
||||
v_shortcutPath = "sdmc:/3ds/Universal-Updater/shortcuts", v_firmPath = "sdmc:/luma/payloads", v_theme = "Default";
|
||||
|
||||
bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true,
|
||||
v_showBg = false, v_customFont = false, v_changelog = true, v_prompt = true, v_3dsxInFolder = false;
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019-2021 Universal-Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_UPDATER_THEME_HPP
|
||||
#define _UNIVERSAL_UPDATER_THEME_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
#include <citro2d.h>
|
||||
#include <string>
|
||||
|
||||
class Theme {
|
||||
public:
|
||||
Theme(const std::string &ThemeJSON = "sdmc:/3ds/Universal-Updater/Themes.json");
|
||||
void InitWithDefaultColors(const std::string &ThemePath = "sdmc:/3ds/Universal-Updater/Themes.json");
|
||||
void LoadTheme(const std::string &ThemeName);
|
||||
std::vector<std::string> ThemeNames();
|
||||
uint32_t GetThemeColor(const std::string &colorString, const uint32_t DefaultColor);
|
||||
|
||||
uint32_t BarColor() const { return this->vBarColor; };
|
||||
uint32_t BGColor() const { return this->vBGColor; };
|
||||
uint32_t BarOutline() const { return this->vBarOutline; };
|
||||
uint32_t TextColor() const { return this->vTextColor; };
|
||||
uint32_t EntryBar() const { return this->vEntryBar; };
|
||||
uint32_t EntryOutline() const { return this->vEntryOutline; };
|
||||
uint32_t BoxInside() const { return this->vBoxInside; };
|
||||
uint32_t BoxSelected() const { return this->vBoxSelected; };
|
||||
uint32_t BoxUnselected() const { return this->vBoxUnselected; };
|
||||
uint32_t ProgressbarOut() const { return this->vProgressbarOut; };
|
||||
uint32_t ProgressbarIn() const { return this->vProgressbarIn; };
|
||||
uint32_t SearchBar() const { return this->vSearchBar; };
|
||||
uint32_t SearchBarOutline() const { return this->vSearchBarOutline; };
|
||||
uint32_t SideBarSelected() const { return this->vSideBarSelected; };
|
||||
uint32_t SideBarUnselected() const { return this->vSideBarUnselected; };
|
||||
uint32_t MarkSelected() const { return this->vMarkSelected; };
|
||||
uint32_t MarkUnselected() const { return this->vMarkUnselected; };
|
||||
uint32_t DownListPrev() const { return this->vDownListPrev; };
|
||||
uint32_t SideBarIconColor() const { return this->vSideBarIconColor; };
|
||||
private:
|
||||
uint32_t vBarColor = 0, vBGColor = 0, vBarOutline = 0, vTextColor = 0, vEntryBar = 0, vEntryOutline = 0,
|
||||
vBoxInside = 0, vBoxSelected = 0, vBoxUnselected = 0, vProgressbarOut = 0, vProgressbarIn = 0,
|
||||
vSearchBar = 0, vSearchBarOutline = 0, vSideBarSelected = 0, vSideBarUnselected = 0,
|
||||
vMarkSelected = 0, vMarkUnselected = 0, vDownListPrev = 0, vSideBarIconColor = 0;
|
||||
|
||||
int SelectedTheme = 0;
|
||||
bool Loaded = false;
|
||||
nlohmann::json json = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user