mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 01:29:41 +01:00
Customize labels for zero in config sliders.
This commit is contained in:
1 parent
a3f9b954d1
commit
08ebbb4a60
3 files changed
+47
-12
No files matched your search
@@ -343,21 +343,25 @@ void PopupMultiChoice::Draw(UIContext &dc) {
|
||||
|
||||
PopupSliderChoice::PopupSliderChoice(int *value, int minValue, int maxValue, const std::string &text, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams)
|
||||
: Choice(text, "", false, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), step_(1), screenManager_(screenManager), units_(units) {
|
||||
fmt_ = "%i";
|
||||
OnClick.Handle(this, &PopupSliderChoice::HandleClick);
|
||||
}
|
||||
|
||||
PopupSliderChoice::PopupSliderChoice(int *value, int minValue, int maxValue, const std::string &text, int step, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams)
|
||||
: Choice(text, "", false, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), step_(step), screenManager_(screenManager), units_(units) {
|
||||
fmt_ = "%i";
|
||||
OnClick.Handle(this, &PopupSliderChoice::HandleClick);
|
||||
}
|
||||
|
||||
PopupSliderChoiceFloat::PopupSliderChoiceFloat(float *value, float minValue, float maxValue, const std::string &text, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams)
|
||||
: Choice(text, "", false, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), step_(1.0f), screenManager_(screenManager), units_(units) {
|
||||
fmt_ = "%2.2f";
|
||||
OnClick.Handle(this, &PopupSliderChoiceFloat::HandleClick);
|
||||
}
|
||||
|
||||
PopupSliderChoiceFloat::PopupSliderChoiceFloat(float *value, float minValue, float maxValue, const std::string &text, float step, ScreenManager *screenManager, const std::string &units, LayoutParams *layoutParams)
|
||||
: Choice(text, "", false, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), step_(step), screenManager_(screenManager), units_(units) {
|
||||
fmt_ = "%2.2f";
|
||||
OnClick.Handle(this, &PopupSliderChoiceFloat::HandleClick);
|
||||
}
|
||||
|
||||
@@ -387,7 +391,11 @@ void PopupSliderChoice::Draw(UIContext &dc) {
|
||||
}
|
||||
Choice::Draw(dc);
|
||||
char temp[32];
|
||||
sprintf(temp, "%i", *value_);
|
||||
if (zeroLabel_.size() && *value_ == 0) {
|
||||
strcpy(temp, zeroLabel_.c_str());
|
||||
} else {
|
||||
sprintf(temp, fmt_, *value_);
|
||||
}
|
||||
dc.SetFontStyle(dc.theme->uiFont);
|
||||
dc.DrawText(temp, bounds_.x2() - 12, bounds_.centerY(), style.fgColor, ALIGN_RIGHT | ALIGN_VCENTER);
|
||||
}
|
||||
@@ -418,7 +426,11 @@ void PopupSliderChoiceFloat::Draw(UIContext &dc) {
|
||||
}
|
||||
Choice::Draw(dc);
|
||||
char temp[32];
|
||||
sprintf(temp, "%2.2f", *value_);
|
||||
if (zeroLabel_.size() && *value_ == 0.0f) {
|
||||
strcpy(temp, zeroLabel_.c_str());
|
||||
} else {
|
||||
sprintf(temp, fmt_, *value_);
|
||||
}
|
||||
dc.SetFontStyle(dc.theme->uiFont);
|
||||
dc.DrawText(temp, bounds_.x2() - 12, bounds_.centerY(), style.fgColor, ALIGN_RIGHT | ALIGN_VCENTER);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user