build: Restructure romfs assets
@ -58,7 +58,7 @@ namespace hex {
|
||||
|
||||
|
||||
static std::vector<std::string> getThemeNames();
|
||||
static const std::string &getThemeImagePostfix();
|
||||
static const std::string &getImageTheme();
|
||||
|
||||
static std::optional<ImColor> parseColorString(const std::string &colorString);
|
||||
|
||||
@ -88,7 +88,7 @@ namespace hex {
|
||||
static std::map<std::string, nlohmann::json> s_themes;
|
||||
static std::map<std::string, ThemeHandler> s_themeHandlers;
|
||||
static std::map<std::string, StyleHandler> s_styleHandlers;
|
||||
static std::string s_imagePostfix;
|
||||
static std::string s_imageTheme;
|
||||
static std::string s_currTheme;
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace hex {
|
||||
std::map<std::string, nlohmann::json> ThemeManager::s_themes;
|
||||
std::map<std::string, ThemeManager::ThemeHandler> ThemeManager::s_themeHandlers;
|
||||
std::map<std::string, ThemeManager::StyleHandler> ThemeManager::s_styleHandlers;
|
||||
std::string ThemeManager::s_imagePostfix;
|
||||
std::string ThemeManager::s_imageTheme;
|
||||
std::string ThemeManager::s_currTheme;
|
||||
|
||||
void ThemeManager::addThemeHandler(const std::string &name, const ColorMap &colorMap, const std::function<ImColor(u32)> &getFunction, const std::function<void(u32, ImColor)> &setFunction) {
|
||||
@ -62,7 +62,7 @@ namespace hex {
|
||||
nlohmann::json ThemeManager::exportCurrentTheme(const std::string &name) {
|
||||
nlohmann::json theme = {
|
||||
{ "name", name },
|
||||
{ "image_postfix", s_imagePostfix },
|
||||
{ "image_theme", s_imageTheme },
|
||||
{ "colors", {} },
|
||||
{ "styles", {} },
|
||||
{ "base", s_currTheme }
|
||||
@ -174,11 +174,12 @@ namespace hex {
|
||||
}
|
||||
}
|
||||
|
||||
if (theme.contains("image_postfix")) {
|
||||
if (theme["image_postfix"].is_string()) {
|
||||
s_imagePostfix = theme["image_postfix"].get<std::string>();
|
||||
if (theme.contains("image_theme")) {
|
||||
if (theme["image_theme"].is_string()) {
|
||||
s_imageTheme = theme["image_theme"].get<std::string>();
|
||||
} else {
|
||||
hex::log::error("Theme '{}' has invalid image postfix!", name);
|
||||
hex::log::error("Theme '{}' has invalid image theme!", name);
|
||||
s_imageTheme = "dark";
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,8 +188,8 @@ namespace hex {
|
||||
EventManager::post<EventThemeChanged>();
|
||||
}
|
||||
|
||||
const std::string &ThemeManager::getThemeImagePostfix() {
|
||||
return s_imagePostfix;
|
||||
const std::string &ThemeManager::getImageTheme() {
|
||||
return s_imageTheme;
|
||||
}
|
||||
|
||||
std::vector<std::string> ThemeManager::getThemeNames() {
|
||||
@ -203,7 +204,7 @@ namespace hex {
|
||||
ThemeManager::s_themes.clear();
|
||||
ThemeManager::s_styleHandlers.clear();
|
||||
ThemeManager::s_themeHandlers.clear();
|
||||
ThemeManager::s_imagePostfix.clear();
|
||||
ThemeManager::s_imageTheme.clear();
|
||||
ThemeManager::s_currTheme.clear();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -153,7 +153,7 @@
|
||||
"string": "#008080FF"
|
||||
}
|
||||
},
|
||||
"image_postfix": "_dark",
|
||||
"image_theme": "dark",
|
||||
"name": "Classic",
|
||||
"styles": {
|
||||
"imgui": {
|
||||
|
@ -153,7 +153,7 @@
|
||||
"string": "#E07070FF"
|
||||
}
|
||||
},
|
||||
"image_postfix": "_dark",
|
||||
"image_theme": "dark",
|
||||
"name": "Dark",
|
||||
"styles": {
|
||||
"imgui": {
|
||||
|
@ -153,7 +153,7 @@
|
||||
"string": "#A02020FF"
|
||||
}
|
||||
},
|
||||
"image_postfix": "_light",
|
||||
"image_theme": "light",
|
||||
"name": "Light",
|
||||
"styles": {
|
||||
"imgui": {
|
||||
|
@ -53,7 +53,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (!this->m_logoTexture.isValid()) {
|
||||
auto logo = romfs::get("logo.png");
|
||||
auto logo = romfs::get("assets/common/logo.png");
|
||||
this->m_logoTexture = ImGui::Texture(reinterpret_cast<const ImU8 *>(logo.data()), logo.size());
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void ViewAbout::drawLicensePage() {
|
||||
ImGui::TextFormattedWrapped("{}", romfs::get("LICENSE").string());
|
||||
ImGui::TextFormattedWrapped("{}", romfs::get("licenses/LICENSE").string());
|
||||
}
|
||||
|
||||
void ViewAbout::drawAboutPopup() {
|
||||
|
@ -421,8 +421,8 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
ThemeManager::changeTheme(theme);
|
||||
s_bannerTexture = changeTexture(hex::format("banner{}.png", ThemeManager::getThemeImagePostfix()));
|
||||
s_backdropTexture = changeTexture(hex::format("backdrop{}.png", ThemeManager::getThemeImagePostfix()));
|
||||
s_bannerTexture = changeTexture(hex::format("assets/{}/banner.png", ThemeManager::getImageTheme()));
|
||||
s_backdropTexture = changeTexture(hex::format("assets/{}/backdrop.png", ThemeManager::getImageTheme()));
|
||||
|
||||
if (!s_bannerTexture.isValid()) {
|
||||
log::error("Failed to load banner texture!");
|
||||
|