1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Change: Draw boolean toggle as a slider widget.

This improves usability as the slider position indicates the state instead of a red/green colour change.
This commit is contained in:
Peter Nelson
2025-04-20 20:36:28 +01:00
committed by Peter Nelson
parent e3858e81dc
commit e3d2d68bd4
7 changed files with 16 additions and 11 deletions

View File

@@ -286,7 +286,7 @@ struct CheatWindow : Window {
case SLE_BOOL: {
bool on = (*(bool*)ce->variable);
DrawBoolButton(button_left, y + button_y_offset, on, true);
DrawBoolButton(button_left, y + button_y_offset, COLOUR_YELLOW, COLOUR_GREY, on, true);
str = GetString(ce->str, on ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
break;
}
@@ -354,7 +354,7 @@ struct CheatWindow : Window {
int32_t value = sd->Read(&GetGameSettings());
if (sd->IsBoolSetting()) {
/* Draw checkbox for boolean-value either on/off */
DrawBoolButton(buttons.left, buttons.top, value != 0, editable);
DrawBoolButton(buttons.left, buttons.top, COLOUR_YELLOW, COLOUR_GREY, value != 0, editable);
} else if (sd->flags.Test(SettingFlag::GuiDropdown)) {
/* Draw [v] button for settings of an enum-type */
DrawDropDownButton(buttons.left, buttons.top, COLOUR_YELLOW, state != 0, editable);