mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 03:44:32 +01:00
Merge pull request #16779 from hrydgard/ui-improvements
UI theme improvements
This commit is contained in:
7 files changed
+34
-25
No files matched your search
@@ -337,6 +337,7 @@ void PopupScreen::CreateViews() {
|
||||
box_->SetHasDropShadow(hasDropShadow_);
|
||||
// Since we scale a bit, make the dropshadow bleed past the edges.
|
||||
box_->SetDropShadowExpand(std::max(dp_xres, dp_yres));
|
||||
box_->SetSpacing(0.0f);
|
||||
|
||||
View *title = new PopupHeader(title_);
|
||||
if (HasTitleBar()) {
|
||||
@@ -668,14 +669,14 @@ void SliderPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
sprintf(temp, "%d", sliderValue_);
|
||||
edit_ = new TextEdit(temp, Title(), "", new LinearLayoutParams(10.0f));
|
||||
edit_->SetMaxLen(16);
|
||||
edit_->SetTextColor(dc.theme->popupStyle.fgColor);
|
||||
edit_->SetTextColor(dc.theme->itemStyle.fgColor);
|
||||
edit_->SetTextAlign(FLAG_DYNAMIC_ASCII);
|
||||
edit_->OnTextChange.Handle(this, &SliderPopupScreen::OnTextChange);
|
||||
changing_ = false;
|
||||
lin->Add(edit_);
|
||||
|
||||
if (!units_.empty())
|
||||
lin->Add(new TextView(units_, new LinearLayoutParams(10.0f)))->SetTextColor(dc.theme->popupStyle.fgColor);
|
||||
lin->Add(new TextView(units_, new LinearLayoutParams(10.0f)))->SetTextColor(dc.theme->itemStyle.fgColor);
|
||||
|
||||
if (!negativeLabel_.empty())
|
||||
vert->Add(new CheckBox(&disabled_, negativeLabel_));
|
||||
@@ -702,13 +703,13 @@ void SliderFloatPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
sprintf(temp, "%0.3f", sliderValue_);
|
||||
edit_ = new TextEdit(temp, Title(), "", new LinearLayoutParams(10.0f));
|
||||
edit_->SetMaxLen(16);
|
||||
edit_->SetTextColor(dc.theme->popupStyle.fgColor);
|
||||
edit_->SetTextColor(dc.theme->itemStyle.fgColor);
|
||||
edit_->SetTextAlign(FLAG_DYNAMIC_ASCII);
|
||||
edit_->OnTextChange.Handle(this, &SliderFloatPopupScreen::OnTextChange);
|
||||
changing_ = false;
|
||||
lin->Add(edit_);
|
||||
if (!units_.empty())
|
||||
lin->Add(new TextView(units_, new LinearLayoutParams(10.0f)))->SetTextColor(dc.theme->popupStyle.fgColor);
|
||||
lin->Add(new TextView(units_, new LinearLayoutParams(10.0f)))->SetTextColor(dc.theme->itemStyle.fgColor);
|
||||
|
||||
// slider_ = parent->Add(new SliderFloat(&sliderValue_, minValue_, maxValue_, new LinearLayoutParams(UI::Margins(10, 5))));
|
||||
if (IsFocusMovementEnabled())
|
||||
|
||||
@@ -98,7 +98,7 @@ protected:
|
||||
void update() override;
|
||||
|
||||
private:
|
||||
UI::ViewGroup *box_;
|
||||
UI::LinearLayout *box_;
|
||||
UI::Button *defaultButton_;
|
||||
std::string title_;
|
||||
std::string button1_;
|
||||
|
||||
+6
-6
@@ -664,8 +664,8 @@ void PopupHeader::Draw(UIContext &dc) {
|
||||
dc.PushScissor(tb);
|
||||
}
|
||||
|
||||
dc.DrawText(text_.c_str(), bounds_.x + tx, bounds_.centerY(), dc.theme->popupTitle.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), dc.theme->popupTitle.fgColor);
|
||||
dc.DrawText(text_.c_str(), bounds_.x + tx, bounds_.centerY(), dc.theme->itemStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), dc.theme->itemStyle.fgColor);
|
||||
|
||||
if (availableWidth < tw) {
|
||||
dc.PopScissor();
|
||||
@@ -1433,8 +1433,8 @@ void Slider::Clamp() {
|
||||
|
||||
void Slider::Draw(UIContext &dc) {
|
||||
bool focus = HasFocus();
|
||||
uint32_t linecolor = dc.theme->popupTitle.fgColor;
|
||||
Style knobStyle = (down_ || focus) ? dc.theme->popupTitle : dc.theme->popupStyle;
|
||||
uint32_t linecolor = dc.theme->itemStyle.fgColor;
|
||||
Style knobStyle = (down_ || focus) ? dc.theme->itemStyle : dc.theme->popupStyle;
|
||||
|
||||
float knobX = ((float)(*value_) - minValue_) / (maxValue_ - minValue_) * (bounds_.w - paddingLeft_ - paddingRight_) + (bounds_.x + paddingLeft_);
|
||||
dc.FillRect(Drawable(linecolor), Bounds(bounds_.x + paddingLeft_, bounds_.centerY() - 2, knobX - (bounds_.x + paddingLeft_), 4));
|
||||
@@ -1558,8 +1558,8 @@ void SliderFloat::Clamp() {
|
||||
|
||||
void SliderFloat::Draw(UIContext &dc) {
|
||||
bool focus = HasFocus();
|
||||
uint32_t linecolor = dc.theme->popupTitle.fgColor;
|
||||
Style knobStyle = (down_ || focus) ? dc.theme->popupTitle : dc.theme->popupStyle;
|
||||
uint32_t linecolor = dc.theme->itemStyle.fgColor;
|
||||
Style knobStyle = (down_ || focus) ? dc.theme->itemStyle : dc.theme->popupStyle;
|
||||
|
||||
float knobX = (*value_ - minValue_) / (maxValue_ - minValue_) * (bounds_.w - paddingLeft_ - paddingRight_) + (bounds_.x + paddingLeft_);
|
||||
dc.FillRect(Drawable(linecolor), Bounds(bounds_.x + paddingLeft_, bounds_.centerY() - 2, knobX - (bounds_.x + paddingLeft_), 4));
|
||||
|
||||
@@ -108,7 +108,6 @@ struct Theme {
|
||||
Style headerStyle;
|
||||
Style infoStyle;
|
||||
|
||||
Style popupTitle;
|
||||
Style popupStyle;
|
||||
|
||||
uint32_t backgroundColor;
|
||||
|
||||
+1
-1
@@ -1104,7 +1104,7 @@ void SettingInfoMessage::Draw(UIContext &dc) {
|
||||
}
|
||||
|
||||
if (alpha >= 0.1f) {
|
||||
UI::Style style = dc.theme->popupTitle;
|
||||
UI::Style style = dc.theme->popupStyle;
|
||||
style.background.color = colorAlpha(style.background.color, alpha - 0.1f);
|
||||
dc.FillRect(style.background, bounds_);
|
||||
}
|
||||
|
||||
+2
-8
@@ -48,8 +48,6 @@ struct ThemeInfo {
|
||||
uint32_t uHeaderStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uInfoStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uInfoStyleBg = 0x00000000;
|
||||
uint32_t uPopupTitleStyleFg = 0xFFE3BE59;
|
||||
uint32_t uPopupStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uPopupStyleBg = 0xFF303030;
|
||||
uint32_t uBackgroundColor = 0xFF754D24;
|
||||
|
||||
@@ -108,13 +106,12 @@ static void LoadThemeInfo(const std::vector<Path> &directories) {
|
||||
|
||||
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.
|
||||
// Alright, let's loop through the sections and see if any is a theme.
|
||||
for (size_t i = 0; i < ini.Sections().size(); i++) {
|
||||
Section §ion = ini.Sections()[i];
|
||||
ThemeInfo info;
|
||||
@@ -132,8 +129,6 @@ static void LoadThemeInfo(const std::vector<Path> &directories) {
|
||||
section.Get("HeaderStyleFg", &info.uHeaderStyleFg, info.uHeaderStyleFg);
|
||||
section.Get("InfoStyleFg", &info.uInfoStyleFg, info.uInfoStyleFg);
|
||||
section.Get("InfoStyleBg", &info.uInfoStyleBg, info.uInfoStyleBg);
|
||||
section.Get("PopupTitleStyleFg", &info.uPopupTitleStyleFg, info.uPopupTitleStyleFg);
|
||||
section.Get("PopupStyleFg", &info.uPopupStyleFg, info.uPopupStyleFg);
|
||||
section.Get("PopupStyleBg", &info.uPopupStyleBg, info.uPopupStyleBg);
|
||||
section.Get("BackgroundColor", &info.uBackgroundColor, info.uBackgroundColor);
|
||||
|
||||
@@ -219,8 +214,7 @@ void UpdateTheme(UIContext *ctx) {
|
||||
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.popupStyle = MakeStyle(themeInfos[i].uItemStyleFg, themeInfos[i].uPopupStyleBg);
|
||||
ui_theme.backgroundColor = themeInfos[i].uBackgroundColor;
|
||||
|
||||
// Load any missing atlas metadata (the images are loaded from UIContext).
|
||||
|
||||
@@ -11,12 +11,27 @@ ItemDisabledStyleBg = "#00000055"
|
||||
HeaderStyleFg = "#FFFFFFFF"
|
||||
InfoStyleFg = "#FFFFFFFF"
|
||||
InfoStyleBg = "#00000000"
|
||||
PopupTitleStyleFg = "#59BEE3FF"
|
||||
PopupStyleFg = "#FFFFFFFF"
|
||||
PopupStyleBg = "#303030FF"
|
||||
PopupStyleBg = "#1f4d5eFF"
|
||||
BackgroundColor = "#244D75FF"
|
||||
UIAtlas = "../ui_atlas"
|
||||
|
||||
# Colors are either in the format "#RGBA" or 0xABGR (e.g. green is "#00FF00FF" or 0xFF00FF00)
|
||||
# Atlas should be in the format path/to/filename where both filename.zim and filename.meta are
|
||||
# Unprovided entry will use the default value
|
||||
# Unprovided entry will use the default value
|
||||
|
||||
[Dark]
|
||||
Name = "Dark"
|
||||
ItemStyleFg = "#FFFFFFFF"
|
||||
ItemStyleBg = "#13405255"
|
||||
ItemFocusedStyleFg = "#FFFFFFFF"
|
||||
ItemFocusedStyleBg = "#3799bdFF"
|
||||
ItemDownStyleFg = "#FFFFFFFF"
|
||||
ItemDownStyleBg = "#2b7b99FF"
|
||||
ItemDisabledStyleFg = "#EEEEEE80"
|
||||
ItemDisabledStyleBg = "#1b1c1c55"
|
||||
HeaderStyleFg = "#FFFFFFFF"
|
||||
InfoStyleFg = "#FFFFFFFF"
|
||||
InfoStyleBg = "#00000000"
|
||||
PopupStyleBg = "#0c1d24FF"
|
||||
BackgroundColor = "#000000FF"
|
||||
UIAtlas = "../ui_atlas"
|
||||
Reference in new issue
Block a user