Add volume controls to newui

This commit is contained in:
Henrik Rydgard 2013-07-18 10:26:29 +02:00
parent df89065aab
commit 47b65ce200
4 changed files with 36 additions and 2 deletions

View file

@ -99,7 +99,7 @@ void Config::Load(const char *iniFileName)
#endif
graphics->Get("BufferedRendering", &bBufferedRendering, true);
graphics->Get("HardwareTransform", &bHardwareTransform, true);
graphics->Get("TextureFiltering", &iTexFiltering, false);
graphics->Get("TextureFiltering", &iTexFiltering, 1);
graphics->Get("SSAA", &SSAntiAliasing, 0);
graphics->Get("VBO", &bUseVBO, false);
graphics->Get("FrameSkip", &iFrameSkip, 0);

View file

@ -36,6 +36,7 @@ public:
I18NCategory *category, ScreenManager *screenManager, LayoutParams *layoutParams = 0)
: Choice(text, "", false, layoutParams), value_(value), choices_(choices), minVal_(minVal), numChoices_(numChoices),
category_(category), screenManager_(screenManager) {
if (*value < minVal) *value = minVal;
OnClick.Handle(this, &PopupMultiChoice::HandleClick);
UpdateText();
}
@ -83,8 +84,38 @@ void PopupMultiChoice::Draw(UIContext &dc) {
dc.Draw()->DrawText(dc.theme->uiFont, valueText_.c_str(), bounds_.x2() - 8, bounds_.centerY(), 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_VCENTER);
}
class PopupSliderChoice : public Choice {
public:
PopupSliderChoice(int *value, int minValue, int maxValue, const std::string &text, ScreenManager *screenManager, LayoutParams *layoutParams = 0)
: Choice(text, "", false, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), screenManager_(screenManager) {
OnClick.Handle(this, &PopupSliderChoice::HandleClick);
}
void Draw(UIContext &dc);
private:
EventReturn HandleClick(EventParams &e);
int *value_;
int minValue_;
int maxValue_;
ScreenManager *screenManager_;
};
EventReturn PopupSliderChoice::HandleClick(EventParams &e) {
Screen *popupScreen = new SliderPopupScreen(value_, minValue_, maxValue_, text_);
screenManager_->push(popupScreen);
return EVENT_DONE;
}
void PopupSliderChoice::Draw(UIContext &dc) {
Choice::Draw(dc);
char temp[4];
sprintf(temp, "%i", *value_);
dc.Draw()->DrawText(dc.theme->uiFont, temp, bounds_.x2() - 8, bounds_.centerY(), 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_VCENTER);
}
}
void GameSettingsScreen::CreateViews() {
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
@ -167,6 +198,8 @@ void GameSettingsScreen::CreateViews() {
audioSettingsScroll->Add(audioSettings);
tabHolder->AddTab("Audio", audioSettingsScroll);
audioSettings->Add(new Choice(a->T("Download Atrac3+ plugin")))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin);
audioSettings->Add(new PopupSliderChoice(&g_Config.iSEVolume, 0, 8, a->T("FX volume"), screenManager()));
audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, 8, a->T("BGM volume"), screenManager()));
audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound")));
audioSettings->Add(new CheckBox(&g_Config.bEnableAtrac3plus, a->T("Enable Atrac3+")));

View file

@ -411,6 +411,7 @@ void NativeInitGraphics() {
ui_theme.checkOn = I_CHECKEDBOX;
ui_theme.checkOff = I_SQUARE;
ui_theme.whiteImage = SOLIDWHITE;
ui_theme.sliderKnob = I_CIRCLE;
ui_theme.buttonStyle.background = UI::Drawable(UI::DRAW_4GRID, I_BUTTON);
ui_theme.buttonStyle.fgColor = 0xFFFFFFFF;
ui_theme.buttonStyle.image = I_BUTTON;

2
native

@ -1 +1 @@
Subproject commit 07feef3f445eba07958eb5c86dfc5a299ca4a1ac
Subproject commit cd8987b33bbe299af0383609db28fecd6546bffe