mirror of https://github.com/OpenTTD/OpenTTD
Added a variable in settings_gui that can remember the previous gui scale that was set. This means that toggling the auto scale on and then off will revert the scale to it's previous value.
parent
6c84dd1f32
commit
a87144d669
|
@ -424,6 +424,7 @@ struct GameOptionsWindow : Window {
|
|||
GameSettings *opt = nullptr;
|
||||
bool reload = false;
|
||||
int gui_scale = 0;
|
||||
static inline int previous_gui_scale = 0; ///< Previous GUI scale.
|
||||
static inline WidgetID active_tab = WID_GO_TAB_GENERAL;
|
||||
|
||||
GameOptionsWindow(WindowDesc &desc) : Window(desc), filter_editbox(50), gui_scale(_gui_scale)
|
||||
|
@ -1072,9 +1073,12 @@ struct GameOptionsWindow : Window {
|
|||
case WID_GO_GUI_SCALE_AUTO:
|
||||
{
|
||||
if (_gui_scale_cfg == -1) {
|
||||
_gui_scale_cfg = _gui_scale;
|
||||
_gui_scale_cfg = previous_gui_scale; // Store the previous GUI scale value
|
||||
this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, false);
|
||||
if (AdjustGUIZoom(false)) ReInitAllWindows(true);
|
||||
this->gui_scale = _gui_scale;
|
||||
} else {
|
||||
previous_gui_scale = _gui_scale; // Set the previous GUI scale value as the current one
|
||||
_gui_scale_cfg = -1;
|
||||
this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, true);
|
||||
if (AdjustGUIZoom(false)) ReInitAllWindows(true);
|
||||
|
|
Loading…
Reference in New Issue