diff options
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r-- | src/settings_gui.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 2faf2b150..a15f2ff58 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -36,6 +36,7 @@ #include "textfile_gui.h" #include "stringfilter_type.h" #include "querystring_gui.h" +#include "fontcache.h" #include <vector> @@ -64,6 +65,13 @@ static const StringID _gui_zoom_dropdown[] = { INVALID_STRING_ID, }; +static const StringID _font_zoom_dropdown[] = { + STR_GAME_OPTIONS_FONT_ZOOM_DROPDOWN_NORMAL, + STR_GAME_OPTIONS_FONT_ZOOM_DROPDOWN_2X_ZOOM, + STR_GAME_OPTIONS_FONT_ZOOM_DROPDOWN_4X_ZOOM, + INVALID_STRING_ID, +}; + int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1; ///< Number of original town names. static StringID *_grf_names = NULL; ///< Pointer to town names defined by NewGRFs. static int _nb_grf_names = 0; ///< Number of town names defined by NewGRFs. @@ -302,6 +310,16 @@ struct GameOptionsWindow : Window { break; } + case WID_GO_FONT_ZOOM_DROPDOWN: { + list = new DropDownList(); + *selected_index = ZOOM_LVL_OUT_4X - _font_zoom; + const StringID *items = _font_zoom_dropdown; + for (int i = 0; *items != INVALID_STRING_ID; items++, i++) { + *list->Append() = new DropDownListStringItem(*items, i, false); + } + break; + } + case WID_GO_BASE_GRF_DROPDOWN: list = BuildSetDropDownList<BaseGraphics>(selected_index, (_game_mode == GM_MENU)); break; @@ -331,6 +349,7 @@ struct GameOptionsWindow : Window { case WID_GO_LANG_DROPDOWN: SetDParamStr(0, _current_language->own_name); break; case WID_GO_RESOLUTION_DROPDOWN: SetDParam(0, GetCurRes() == _num_resolutions ? STR_GAME_OPTIONS_RESOLUTION_OTHER : SPECSTR_RESOLUTION_START + GetCurRes()); break; case WID_GO_GUI_ZOOM_DROPDOWN: SetDParam(0, _gui_zoom_dropdown[ZOOM_LVL_OUT_4X - _gui_zoom]); break; + case WID_GO_FONT_ZOOM_DROPDOWN: SetDParam(0, _font_zoom_dropdown[ZOOM_LVL_OUT_4X - _font_zoom]); break; case WID_GO_BASE_GRF_DROPDOWN: SetDParamStr(0, BaseGraphics::GetUsedSet()->name); break; case WID_GO_BASE_GRF_STATUS: SetDParam(0, BaseGraphics::GetUsedSet()->GetNumInvalid()); break; case WID_GO_BASE_SFX_DROPDOWN: SetDParamStr(0, BaseSounds::GetUsedSet()->name); break; @@ -541,6 +560,14 @@ struct GameOptionsWindow : Window { UpdateAllVirtCoords(); break; + case WID_GO_FONT_ZOOM_DROPDOWN: + GfxClearSpriteCache(); + _font_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index); + ClearFontCache(); + UpdateAllVirtCoords(); + ReInitAllWindows(); + break; + case WID_GO_BASE_GRF_DROPDOWN: this->SetMediaSet<BaseGraphics>(index); break; @@ -616,6 +643,9 @@ static const NWidgetPart _nested_game_options_widgets[] = { NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_CURRENCY_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 0), SetFill(0, 1), + NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_FONT_ZOOM, STR_NULL), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_FONT_ZOOM_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_FONT_ZOOM_DROPDOWN_TOOLTIP), SetFill(1, 0), + EndContainer(), EndContainer(), EndContainer(), |