mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Allow custom UI themes
This commit is contained in:
parent
21736d1ab4
commit
5e1062678f
@ -1235,6 +1235,8 @@ list(APPEND NativeAppSource
|
||||
UI/TextureUtil.cpp
|
||||
UI/ComboKeyMappingScreen.h
|
||||
UI/ComboKeyMappingScreen.cpp
|
||||
UI/Theme.h
|
||||
UI/Theme.cpp
|
||||
)
|
||||
|
||||
if(ANDROID)
|
||||
|
@ -1169,34 +1169,7 @@ static ConfigSetting upgradeSettings[] = {
|
||||
};
|
||||
|
||||
static ConfigSetting themeSettings[] = {
|
||||
ConfigSetting("ItemStyleFg", &g_Config.uItemStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ItemStyleBg", &g_Config.uItemStyleBg, 0x55000000, true, false),
|
||||
ConfigSetting("ItemFocusedStyleFg", &g_Config.uItemFocusedStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ItemFocusedStyleBg", &g_Config.uItemFocusedStyleBg, 0xFFEDC24C, true, false),
|
||||
ConfigSetting("ItemDownStyleFg", &g_Config.uItemDownStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ItemDownStyleBg", &g_Config.uItemDownStyleBg, 0xFFBD9939, true, false),
|
||||
ConfigSetting("ItemDisabledStyleFg", &g_Config.uItemDisabledStyleFg, 0x80EEEEEE, true, false),
|
||||
ConfigSetting("ItemDisabledStyleBg", &g_Config.uItemDisabledStyleBg, 0x55E0D4AF, true, false),
|
||||
ConfigSetting("ItemHighlightedStyleFg", &g_Config.uItemHighlightedStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ItemHighlightedStyleBg", &g_Config.uItemHighlightedStyleBg, 0x55BDBB39, true, false),
|
||||
|
||||
ConfigSetting("ButtonStyleFg", &g_Config.uButtonStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ButtonStyleBg", &g_Config.uButtonStyleBg, 0x55000000, true, false),
|
||||
ConfigSetting("ButtonFocusedStyleFg", &g_Config.uButtonFocusedStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ButtonFocusedStyleBg", &g_Config.uButtonFocusedStyleBg, 0xFFEDC24C, true, false),
|
||||
ConfigSetting("ButtonDownStyleFg", &g_Config.uButtonDownStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ButtonDownStyleBg", &g_Config.uButtonDownStyleBg, 0xFFBD9939, true, false),
|
||||
ConfigSetting("ButtonDisabledStyleFg", &g_Config.uButtonDisabledStyleFg, 0x80EEEEEE, true, false),
|
||||
ConfigSetting("ButtonDisabledStyleBg", &g_Config.uButtonDisabledStyleBg, 0x55E0D4AF, true, false),
|
||||
ConfigSetting("ButtonHighlightedStyleFg", &g_Config.uButtonHighlightedStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("ButtonHighlightedStyleBg", &g_Config.uButtonHighlightedStyleBg, 0x55BDBB39, true, false),
|
||||
|
||||
ConfigSetting("HeaderStyleFg", &g_Config.uHeaderStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("InfoStyleFg", &g_Config.uInfoStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("InfoStyleBg", &g_Config.uInfoStyleBg, 0x00000000U, true, false),
|
||||
ConfigSetting("PopupTitleStyleFg", &g_Config.uPopupTitleStyleFg, 0xFFE3BE59, true, false),
|
||||
ConfigSetting("PopupStyleFg", &g_Config.uPopupStyleFg, 0xFFFFFFFF, true, false),
|
||||
ConfigSetting("PopupStyleBg", &g_Config.uPopupStyleBg, 0xFF303030, true, false),
|
||||
ConfigSetting("ThemeName", &g_Config.sThemeName, "Default", true, false),
|
||||
|
||||
ConfigSetting(false),
|
||||
};
|
||||
|
@ -255,35 +255,7 @@ public:
|
||||
bool bShowOnScreenMessages;
|
||||
int iBackgroundAnimation; // enum BackgroundAnimation
|
||||
|
||||
// TODO: Maybe move to a separate theme system.
|
||||
uint32_t uItemStyleFg;
|
||||
uint32_t uItemStyleBg;
|
||||
uint32_t uItemFocusedStyleFg;
|
||||
uint32_t uItemFocusedStyleBg;
|
||||
uint32_t uItemDownStyleFg;
|
||||
uint32_t uItemDownStyleBg;
|
||||
uint32_t uItemDisabledStyleFg;
|
||||
uint32_t uItemDisabledStyleBg;
|
||||
uint32_t uItemHighlightedStyleFg;
|
||||
uint32_t uItemHighlightedStyleBg;
|
||||
|
||||
uint32_t uButtonStyleFg;
|
||||
uint32_t uButtonStyleBg;
|
||||
uint32_t uButtonFocusedStyleFg;
|
||||
uint32_t uButtonFocusedStyleBg;
|
||||
uint32_t uButtonDownStyleFg;
|
||||
uint32_t uButtonDownStyleBg;
|
||||
uint32_t uButtonDisabledStyleFg;
|
||||
uint32_t uButtonDisabledStyleBg;
|
||||
uint32_t uButtonHighlightedStyleFg;
|
||||
uint32_t uButtonHighlightedStyleBg;
|
||||
|
||||
uint32_t uHeaderStyleFg;
|
||||
uint32_t uInfoStyleFg;
|
||||
uint32_t uInfoStyleBg;
|
||||
uint32_t uPopupTitleStyleFg;
|
||||
uint32_t uPopupStyleFg;
|
||||
uint32_t uPopupStyleBg;
|
||||
std::string sThemeName;
|
||||
|
||||
bool bLogFrameDrops;
|
||||
bool bShowDebugStats;
|
||||
|
@ -645,6 +645,8 @@ Path GetSysDirectory(PSPDirectories directoryType) {
|
||||
return pspDirectory / "AUDIO";
|
||||
case DIRECTORY_CUSTOM_SHADERS:
|
||||
return pspDirectory / "shaders";
|
||||
case DIRECTORY_CUSTOM_THEMES:
|
||||
return pspDirectory / "themes";
|
||||
|
||||
case DIRECTORY_MEMSTICK_ROOT:
|
||||
return g_Config.memStickDirectory;
|
||||
|
@ -56,6 +56,7 @@ enum PSPDirectories {
|
||||
DIRECTORY_MEMSTICK_ROOT,
|
||||
DIRECTORY_EXDATA,
|
||||
DIRECTORY_CUSTOM_SHADERS,
|
||||
DIRECTORY_CUSTOM_THEMES,
|
||||
};
|
||||
|
||||
class GraphicsContext;
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "UI/TiltEventProcessor.h"
|
||||
#include "UI/GPUDriverTestScreen.h"
|
||||
#include "UI/MemStickScreen.h"
|
||||
#include "UI/Theme.h"
|
||||
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/OSVersion.h"
|
||||
@ -191,6 +192,7 @@ bool PathToVisualUsbPath(Path path, std::string &outPath) {
|
||||
|
||||
void GameSettingsScreen::CreateViews() {
|
||||
ReloadAllPostShaderInfo(screenManager()->getDrawContext());
|
||||
ReloadAllThemeInfo();
|
||||
|
||||
if (editThenRestore_) {
|
||||
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, gamePath_, 0);
|
||||
@ -881,6 +883,14 @@ void GameSettingsScreen::CreateViews() {
|
||||
if (backgroundChoice_ != nullptr) {
|
||||
backgroundChoice_->OnClick.Handle(this, &GameSettingsScreen::OnChangeBackground);
|
||||
}
|
||||
|
||||
PopupMultiChoiceDynamic *theme = systemSettings->Add(new PopupMultiChoiceDynamic(&g_Config.sThemeName, gr->T("Color Theme"), GetThemeInfoNames(), nullptr, screenManager()));
|
||||
theme->OnChoice.Add([=](EventParams &e) {
|
||||
UpdateTheme();
|
||||
|
||||
return UI::EVENT_CONTINUE;
|
||||
});
|
||||
|
||||
static const char *backgroundAnimations[] = { "No animation", "Floating symbols", "Recent games", "Waves", "Moving background" };
|
||||
systemSettings->Add(new PopupMultiChoice(&g_Config.iBackgroundAnimation, sy->T("UI background animation"), backgroundAnimations, 0, ARRAY_SIZE(backgroundAnimations), sy->GetName(), screenManager()));
|
||||
|
||||
|
@ -115,6 +115,7 @@
|
||||
#include "UI/RemoteISOScreen.h"
|
||||
#include "UI/TiltEventProcessor.h"
|
||||
#include "UI/TextureUtil.h"
|
||||
#include "UI/Theme.h"
|
||||
|
||||
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
|
||||
#include "Qt/QtHost.h"
|
||||
@ -131,7 +132,6 @@
|
||||
|
||||
// The new UI framework, for initialization
|
||||
|
||||
static UI::Theme ui_theme;
|
||||
static Atlas g_ui_atlas;
|
||||
static Atlas g_font_atlas;
|
||||
|
||||
@ -873,49 +873,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
restarting = false;
|
||||
}
|
||||
|
||||
static UI::Style MakeStyle(uint32_t fg, uint32_t bg) {
|
||||
UI::Style s;
|
||||
s.background = UI::Drawable(bg);
|
||||
s.fgColor = fg;
|
||||
return s;
|
||||
}
|
||||
|
||||
static void UIThemeInit() {
|
||||
#if defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP) || defined(USING_QT_UI)
|
||||
ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 22);
|
||||
ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 15);
|
||||
ui_theme.uiFontSmaller = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 12);
|
||||
#else
|
||||
ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), "", 20);
|
||||
ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), "", 14);
|
||||
ui_theme.uiFontSmaller = UI::FontStyle(FontID("UBUNTU24"), "", 11);
|
||||
#endif
|
||||
|
||||
ui_theme.checkOn = ImageID("I_CHECKEDBOX");
|
||||
ui_theme.checkOff = ImageID("I_SQUARE");
|
||||
ui_theme.whiteImage = ImageID("I_SOLIDWHITE");
|
||||
ui_theme.sliderKnob = ImageID("I_CIRCLE");
|
||||
ui_theme.dropShadow4Grid = ImageID("I_DROP_SHADOW");
|
||||
|
||||
ui_theme.itemStyle = MakeStyle(g_Config.uItemStyleFg, g_Config.uItemStyleBg);
|
||||
ui_theme.itemFocusedStyle = MakeStyle(g_Config.uItemFocusedStyleFg, g_Config.uItemFocusedStyleBg);
|
||||
ui_theme.itemDownStyle = MakeStyle(g_Config.uItemDownStyleFg, g_Config.uItemDownStyleBg);
|
||||
ui_theme.itemDisabledStyle = MakeStyle(g_Config.uItemDisabledStyleFg, g_Config.uItemDisabledStyleBg);
|
||||
ui_theme.itemHighlightedStyle = MakeStyle(g_Config.uItemHighlightedStyleFg, g_Config.uItemHighlightedStyleBg);
|
||||
|
||||
ui_theme.buttonStyle = MakeStyle(g_Config.uButtonStyleFg, g_Config.uButtonStyleBg);
|
||||
ui_theme.buttonFocusedStyle = MakeStyle(g_Config.uButtonFocusedStyleFg, g_Config.uButtonFocusedStyleBg);
|
||||
ui_theme.buttonDownStyle = MakeStyle(g_Config.uButtonDownStyleFg, g_Config.uButtonDownStyleBg);
|
||||
ui_theme.buttonDisabledStyle = MakeStyle(g_Config.uButtonDisabledStyleFg, g_Config.uButtonDisabledStyleBg);
|
||||
ui_theme.buttonHighlightedStyle = MakeStyle(g_Config.uButtonHighlightedStyleFg, g_Config.uButtonHighlightedStyleBg);
|
||||
|
||||
ui_theme.headerStyle.fgColor = g_Config.uHeaderStyleFg;
|
||||
ui_theme.infoStyle = MakeStyle(g_Config.uInfoStyleFg, g_Config.uInfoStyleBg);
|
||||
|
||||
ui_theme.popupTitle.fgColor = g_Config.uPopupTitleStyleFg;
|
||||
ui_theme.popupStyle = MakeStyle(g_Config.uPopupStyleFg, g_Config.uPopupStyleBg);
|
||||
}
|
||||
|
||||
void RenderOverlays(UIContext *dc, void *userdata);
|
||||
bool CreateGlobalPipelines();
|
||||
|
||||
@ -962,10 +919,9 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
|
||||
ui_draw2d_front.SetAtlas(&g_ui_atlas);
|
||||
ui_draw2d_front.SetFontAtlas(&g_font_atlas);
|
||||
|
||||
UIThemeInit();
|
||||
|
||||
UpdateTheme();
|
||||
uiContext = new UIContext();
|
||||
uiContext->theme = &ui_theme;
|
||||
uiContext->theme = GetTheme();
|
||||
|
||||
ui_draw2d.Init(g_draw, texColorPipeline);
|
||||
ui_draw2d_front.Init(g_draw, texColorPipeline);
|
||||
|
238
UI/Theme.cpp
Normal file
238
UI/Theme.cpp
Normal file
@ -0,0 +1,238 @@
|
||||
// Copyright (c) 2013- PPSSPP Project.
|
||||
|
||||
// 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, version 2.0 or later versions.
|
||||
|
||||
// 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "UI/Theme.h"
|
||||
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/File/VFS/VFS.h"
|
||||
#include "Common/Data/Format/IniFile.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
|
||||
#include "Common/UI/View.h"
|
||||
#include "Common/UI/Context.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
struct themeInfo {
|
||||
std::string name;
|
||||
|
||||
uint32_t uItemStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemStyleBg = 0x55000000;
|
||||
uint32_t uItemFocusedStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemFocusedStyleBg = 0xFFEDC24C;
|
||||
uint32_t uItemDownStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemDownStyleBg = 0xFFBD9939;
|
||||
uint32_t uItemDisabledStyleFg = 0x80EEEEEE;
|
||||
uint32_t uItemDisabledStyleBg = 0x55E0D4AF;
|
||||
uint32_t uItemHighlightedStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemHighlightedStyleBg = 0x55BDBB39;
|
||||
|
||||
uint32_t uButtonStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uButtonStyleBg = 0x55000000;
|
||||
uint32_t uButtonFocusedStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uButtonFocusedStyleBg = 0xFFBD9939;
|
||||
uint32_t uButtonDownStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uButtonDownStyleBg = 0xFFBD9939;
|
||||
uint32_t uButtonDisabledStyleFg = 0x80EEEEEE;
|
||||
uint32_t uButtonDisabledStyleBg = 0x55E0D4AF;
|
||||
uint32_t uButtonHighlightedStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uButtonHighlightedStyleBg = 0x55BDBB39;
|
||||
|
||||
uint32_t uHeaderStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uInfoStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uInfoStyleBg = 0x00000000;
|
||||
uint32_t uPopupTitleStyleFg = 0xFFE3BE59;
|
||||
uint32_t uPopupStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uPopupStyleBg = 0xFF303030;
|
||||
|
||||
bool operator == (const std::string &other) {
|
||||
return name == other;
|
||||
}
|
||||
bool operator == (const themeInfo &other) {
|
||||
return name == other.name;
|
||||
}
|
||||
};
|
||||
|
||||
static UI::Theme ui_theme;
|
||||
static std::vector<themeInfo> themeInfos;
|
||||
|
||||
static void LoadThemeInfo(const std::vector<Path> &directories) {
|
||||
themeInfos.clear();
|
||||
themeInfo def{};
|
||||
def.name = "Default";
|
||||
themeInfos.push_back(def);
|
||||
|
||||
auto appendTheme = [&](const themeInfo &info) {
|
||||
auto beginErase = std::remove(themeInfos.begin(), themeInfos.end(), info.name);
|
||||
if (beginErase != themeInfos.end()) {
|
||||
themeInfos.erase(beginErase, themeInfos.end());
|
||||
}
|
||||
themeInfos.push_back(info);
|
||||
};
|
||||
|
||||
for (size_t d = 0; d < directories.size(); d++) {
|
||||
std::vector<File::FileInfo> fileInfo;
|
||||
VFSGetFileListing(directories[d].c_str(), &fileInfo, "ini:");
|
||||
|
||||
if (fileInfo.empty()) {
|
||||
File::GetFilesInDir(directories[d], &fileInfo, "ini:");
|
||||
}
|
||||
|
||||
for (size_t f = 0; f < fileInfo.size(); f++) {
|
||||
IniFile ini;
|
||||
bool success = false;
|
||||
Path name = fileInfo[f].fullName;
|
||||
Path path = directories[d];
|
||||
// Hack around Android VFS path bug. really need to redesign this.
|
||||
if (name.ToString().substr(0, 7) == "assets/")
|
||||
name = Path(name.ToString().substr(7));
|
||||
if (path.ToString().substr(0, 7) == "assets/")
|
||||
path = Path(path.ToString().substr(7));
|
||||
|
||||
if (ini.LoadFromVFS(name.ToString()) || ini.Load(fileInfo[f].fullName)) {
|
||||
success = true;
|
||||
// vsh load. meh.
|
||||
}
|
||||
|
||||
if (!success)
|
||||
continue;
|
||||
|
||||
// Alright, let's loop through the sections and see if any is a themes.
|
||||
for (size_t i = 0; i < ini.Sections().size(); i++) {
|
||||
Section §ion = ini.Sections()[i];
|
||||
themeInfo info;
|
||||
section.Get("Name", &info.name, section.name().c_str());
|
||||
|
||||
section.Get("ItemStyleFg", &info.uItemStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ItemStyleBg", &info.uItemStyleBg, 0x55000000);
|
||||
section.Get("ItemFocusedStyleFg", &info.uItemFocusedStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ItemFocusedStyleBg", &info.uItemFocusedStyleBg, 0xFFEDC24C);
|
||||
section.Get("ItemDownStyleFg", &info.uItemDownStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ItemDownStyleBg", &info.uItemDownStyleBg, 0xFFBD9939);
|
||||
section.Get("ItemDisabledStyleFg", &info.uItemDisabledStyleFg, 0x80EEEEEE);
|
||||
section.Get("ItemDisabledStyleBg", &info.uItemDisabledStyleBg, 0x55E0D4AF);
|
||||
section.Get("ItemHighlightedStyleFg", &info.uItemHighlightedStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ItemHighlightedStyleBg", &info.uItemHighlightedStyleBg, 0x55BDBB39);
|
||||
|
||||
section.Get("ButtonStyleFg", &info.uButtonStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ButtonStyleBg", &info.uButtonStyleBg, 0x55000000);
|
||||
section.Get("ButtonFocusedStyleFg", &info.uButtonFocusedStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ButtonFocusedStyleBg", &info.uButtonFocusedStyleBg, 0xFFBD9939);
|
||||
section.Get("ButtonDownStyleFg", &info.uButtonDownStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ButtonDownStyleBg", &info.uButtonDownStyleBg, 0xFFBD9939);
|
||||
section.Get("ButtonDisabledStyleFg", &info.uButtonDisabledStyleFg, 0x80EEEEEE);
|
||||
section.Get("ButtonDisabledStyleBg", &info.uButtonDisabledStyleBg, 0x55E0D4AF);
|
||||
section.Get("ButtonHighlightedStyleFg", &info.uButtonHighlightedStyleFg, 0xFFFFFFFF);
|
||||
section.Get("ButtonHighlightedStyleBg", &info.uButtonHighlightedStyleBg, 0x55BDBB39);
|
||||
|
||||
section.Get("HeaderStyleFg", &info.uHeaderStyleFg, 0xFFFFFFFF);
|
||||
section.Get("InfoStyleFg", &info.uInfoStyleFg, 0xFFFFFFFF);
|
||||
section.Get("InfoStyleBg", &info.uInfoStyleBg, 0x00000000);
|
||||
section.Get("PopupTitleStyleFg", &info.uPopupTitleStyleFg, 0xFFE3BE59);
|
||||
section.Get("PopupStyleFg", &info.uPopupStyleFg, 0xFFFFFFFF);
|
||||
section.Get("PopupStyleBg", &info.uPopupStyleBg, 0xFF303030);
|
||||
|
||||
appendTheme(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static UI::Style MakeStyle (uint32_t fg, uint32_t bg) {
|
||||
UI::Style s;
|
||||
s.background = UI::Drawable(bg);
|
||||
s.fgColor = fg;
|
||||
return s;
|
||||
}
|
||||
|
||||
void UpdateTheme() {
|
||||
// First run, get the default in at least
|
||||
if (themeInfos.empty()) {
|
||||
ReloadAllThemeInfo();
|
||||
}
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < themeInfos.size(); ++i) {
|
||||
if (themeInfos[i].name == g_Config.sThemeName) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset to Default if not found
|
||||
if (i >= themeInfos.size()) {
|
||||
g_Config.sThemeName = "Default";
|
||||
i = 0;
|
||||
}
|
||||
|
||||
#if defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP) || defined(USING_QT_UI)
|
||||
ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 22);
|
||||
ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 15);
|
||||
ui_theme.uiFontSmaller = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 12);
|
||||
#else
|
||||
ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), "", 20);
|
||||
ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), "", 14);
|
||||
ui_theme.uiFontSmaller = UI::FontStyle(FontID("UBUNTU24"), "", 11);
|
||||
#endif
|
||||
|
||||
ui_theme.checkOn = ImageID("I_CHECKEDBOX");
|
||||
ui_theme.checkOff = ImageID("I_SQUARE");
|
||||
ui_theme.whiteImage = ImageID("I_SOLIDWHITE");
|
||||
ui_theme.sliderKnob = ImageID("I_CIRCLE");
|
||||
ui_theme.dropShadow4Grid = ImageID("I_DROP_SHADOW");
|
||||
|
||||
// Actual configurable themes setting start here
|
||||
ui_theme.itemStyle = MakeStyle(themeInfos[i].uItemStyleFg, themeInfos[i].uItemStyleBg);
|
||||
ui_theme.itemFocusedStyle = MakeStyle(themeInfos[i].uItemFocusedStyleFg, themeInfos[i].uItemFocusedStyleBg);
|
||||
ui_theme.itemDownStyle = MakeStyle(themeInfos[i].uItemDownStyleFg, themeInfos[i].uItemDownStyleBg);
|
||||
ui_theme.itemDisabledStyle = MakeStyle(themeInfos[i].uItemDisabledStyleFg, themeInfos[i].uItemDisabledStyleBg);
|
||||
ui_theme.itemHighlightedStyle = MakeStyle(themeInfos[i].uItemHighlightedStyleFg, themeInfos[i].uItemHighlightedStyleBg);
|
||||
|
||||
ui_theme.buttonStyle = MakeStyle(themeInfos[i].uButtonStyleFg, themeInfos[i].uButtonStyleBg);
|
||||
ui_theme.buttonFocusedStyle = MakeStyle(themeInfos[i].uButtonFocusedStyleFg, themeInfos[i].uButtonFocusedStyleBg);
|
||||
ui_theme.buttonDownStyle = MakeStyle(themeInfos[i].uButtonDownStyleFg, themeInfos[i].uButtonDownStyleBg);
|
||||
ui_theme.buttonDisabledStyle = MakeStyle(themeInfos[i].uButtonDisabledStyleFg, themeInfos[i].uButtonDisabledStyleBg);
|
||||
ui_theme.buttonHighlightedStyle = MakeStyle(themeInfos[i].uButtonHighlightedStyleFg, themeInfos[i].uButtonHighlightedStyleBg);
|
||||
|
||||
ui_theme.headerStyle.fgColor = themeInfos[i].uHeaderStyleFg;
|
||||
ui_theme.infoStyle = MakeStyle(themeInfos[i].uInfoStyleFg, themeInfos[i].uInfoStyleBg);
|
||||
|
||||
ui_theme.popupTitle.fgColor = themeInfos[i].uPopupTitleStyleFg;
|
||||
ui_theme.popupStyle = MakeStyle(themeInfos[i].uPopupStyleFg, themeInfos[i].uPopupStyleBg);
|
||||
}
|
||||
|
||||
UI::Theme *GetTheme() {
|
||||
return &ui_theme;
|
||||
}
|
||||
|
||||
void ReloadAllThemeInfo() {
|
||||
std::vector<Path> directories;
|
||||
directories.push_back(Path("themes")); // For VFS
|
||||
directories.push_back(GetSysDirectory(DIRECTORY_CUSTOM_THEMES));
|
||||
LoadThemeInfo(directories);
|
||||
}
|
||||
|
||||
std::vector<std::string> GetThemeInfoNames() {
|
||||
std::vector<std::string> names;
|
||||
for (auto& i : themeInfos)
|
||||
names.push_back(i.name);
|
||||
|
||||
return names;
|
||||
}
|
25
UI/Theme.h
Normal file
25
UI/Theme.h
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2013- PPSSPP Project.
|
||||
|
||||
// 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, version 2.0 or later versions.
|
||||
|
||||
// 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "Common/File/DirListing.h"
|
||||
#include "Common/UI/Context.h"
|
||||
|
||||
void ReloadAllThemeInfo();
|
||||
|
||||
std::vector<std::string> GetThemeInfoNames();
|
||||
void UpdateTheme();
|
||||
UI::Theme *GetTheme();
|
@ -67,6 +67,7 @@
|
||||
<ClCompile Include="TouchControlLayoutScreen.cpp" />
|
||||
<ClCompile Include="TouchControlVisibilityScreen.cpp" />
|
||||
<ClCompile Include="InstallZipScreen.cpp" />
|
||||
<ClCompile Include="Theme.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BackgroundAudio.h" />
|
||||
@ -101,6 +102,7 @@
|
||||
<ClInclude Include="TouchControlLayoutScreen.h" />
|
||||
<ClInclude Include="TouchControlVisibilityScreen.h" />
|
||||
<ClInclude Include="InstallZipScreen.h" />
|
||||
<ClCompile Include="Theme.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ext\discord-rpc-build\discord-rpc.vcxproj">
|
||||
|
@ -396,6 +396,7 @@
|
||||
<ClInclude Include="..\..\UI\GPUDriverTestScreen.h" />
|
||||
<ClInclude Include="..\..\UI\HostTypes.h" />
|
||||
<ClInclude Include="..\..\UI\InstallZipScreen.h" />
|
||||
<ClInclude Include="..\..\UI\Theme.h" />
|
||||
<ClInclude Include="..\..\UI\MainScreen.h" />
|
||||
<ClInclude Include="..\..\UI\MemStickScreen.h" />
|
||||
<ClInclude Include="..\..\UI\MiscScreens.h" />
|
||||
@ -431,6 +432,7 @@
|
||||
<ClCompile Include="..\..\UI\GameSettingsScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\GPUDriverTestScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\InstallZipScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\Theme.cpp" />
|
||||
<ClCompile Include="..\..\UI\MainScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\MemStickScreen.cpp" />
|
||||
<ClCompile Include="..\..\UI\MiscScreens.cpp" />
|
||||
|
@ -686,6 +686,7 @@ LOCAL_SRC_FILES := \
|
||||
$(SRC)/UI/ProfilerDraw.cpp \
|
||||
$(SRC)/UI/NativeApp.cpp \
|
||||
$(SRC)/UI/TextureUtil.cpp \
|
||||
$(SRC)/UI/Theme.cpp \
|
||||
$(SRC)/UI/ComboKeyMappingScreen.cpp
|
||||
|
||||
ifneq ($(SKIPAPP),1)
|
||||
|
Loading…
Reference in New Issue
Block a user