UI: Allow overriding colors in the ini.

This commit is contained in:
Unknown W. Brackets 2017-03-26 09:51:33 -07:00
parent 755429df81
commit c9a5c00bf7
3 changed files with 132 additions and 38 deletions

View file

@ -534,18 +534,15 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
}
}
void NativeInitGraphics(GraphicsContext *graphicsContext) {
ILOG("NativeInitGraphics");
static UI::Style MakeStyle(uint32_t fg, uint32_t bg) {
UI::Style s;
s.background = UI::Drawable(bg);
s.fgColor = fg;
using namespace Draw;
Core_SetGraphicsContext(graphicsContext);
g_draw = graphicsContext->GetDrawContext();
return s;
}
ui_draw2d.SetAtlas(&ui_atlas);
ui_draw2d_front.SetAtlas(&ui_atlas);
// memset(&ui_theme, 0, sizeof(ui_theme));
// New style theme
static void UIThemeInit() {
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
ui_theme.uiFont = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 22);
ui_theme.uiFontSmall = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 15);
@ -562,30 +559,36 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) {
ui_theme.sliderKnob = I_CIRCLE;
ui_theme.dropShadow4Grid = I_DROP_SHADOW;
ui_theme.itemStyle.background = UI::Drawable(0x55000000);
ui_theme.itemStyle.fgColor = 0xFFFFFFFF;
ui_theme.itemFocusedStyle.background = UI::Drawable(0xFFedc24c);
ui_theme.itemFocusedStyle.fgColor = ui_theme.itemStyle.fgColor;
ui_theme.itemDownStyle.background = UI::Drawable(0xFFbd9939);
ui_theme.itemDownStyle.fgColor = 0xFFFFFFFF;
ui_theme.itemDisabledStyle.background = UI::Drawable(0x55E0D4AF);
ui_theme.itemDisabledStyle.fgColor = 0x80EEEEEE;
ui_theme.itemHighlightedStyle.background = UI::Drawable(0x55bdBB39);
ui_theme.itemHighlightedStyle.fgColor = 0xFFFFFFFF;
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 = ui_theme.itemStyle;
ui_theme.buttonFocusedStyle = ui_theme.itemFocusedStyle;
ui_theme.buttonDownStyle = ui_theme.itemDownStyle;
ui_theme.buttonDisabledStyle = ui_theme.itemDisabledStyle;
ui_theme.buttonHighlightedStyle = ui_theme.itemHighlightedStyle;
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 = 0xFFFFFFFF;
ui_theme.infoStyle.fgColor = 0xFFFFFFFF;
ui_theme.infoStyle.background = UI::Drawable(0x00000000);
ui_theme.headerStyle.fgColor = g_Config.uHeaderStyleFg;
ui_theme.infoStyle = MakeStyle(g_Config.uInfoStyleFg, g_Config.uInfoStyleBg);
ui_theme.popupTitle.fgColor = 0xFFE3BE59;
ui_theme.popupStyle.fgColor = 0xFFFFFFFF;
ui_theme.popupStyle.background = UI::Drawable(0xFF303030);
ui_theme.popupTitle.fgColor = g_Config.uPopupTitleStyleFg;
ui_theme.popupStyle = MakeStyle(g_Config.uPopupStyleFg, g_Config.uPopupStyleBg);
}
void NativeInitGraphics(GraphicsContext *graphicsContext) {
ILOG("NativeInitGraphics");
using namespace Draw;
Core_SetGraphicsContext(graphicsContext);
g_draw = graphicsContext->GetDrawContext();
ui_draw2d.SetAtlas(&ui_atlas);
ui_draw2d_front.SetAtlas(&ui_atlas);
UIThemeInit();
uiTexture = CreateTextureFromFile(g_draw, "ui_atlas.zim", ImageFileType::ZIM);
if (!uiTexture) {