Codechange: Add parameters to change range of slider widget.

This commit is contained in:
Peter Nelson
2022-10-23 15:35:35 +01:00
committed by PeterN
parent d35f1d3d06
commit 1180c95372
4 changed files with 29 additions and 15 deletions

View File

@@ -347,11 +347,11 @@ struct GameOptionsWindow : Window {
break;
case WID_GO_BASE_SFX_VOLUME:
DrawSliderWidget(r, _settings_client.music.effect_vol);
DrawSliderWidget(r, 0, INT8_MAX, _settings_client.music.effect_vol);
break;
case WID_GO_BASE_MUSIC_VOLUME:
DrawSliderWidget(r, _settings_client.music.music_vol);
DrawSliderWidget(r, 0, INT8_MAX, _settings_client.music.music_vol);
break;
}
}
@@ -478,7 +478,7 @@ struct GameOptionsWindow : Window {
case WID_GO_BASE_SFX_VOLUME:
case WID_GO_BASE_MUSIC_VOLUME: {
byte &vol = (widget == WID_GO_BASE_MUSIC_VOLUME) ? _settings_client.music.music_vol : _settings_client.music.effect_vol;
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, vol)) {
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, 0, INT8_MAX, vol)) {
if (widget == WID_GO_BASE_MUSIC_VOLUME) MusicDriver::GetInstance()->SetVolume(vol);
this->SetWidgetDirty(widget);
SetWindowClassesDirty(WC_MUSIC_WINDOW);