Add font size to options
This commit is contained in:
parent
86a0d06f99
commit
ec485bae4c
@ -51,6 +51,16 @@
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<label proportion="1" I18N="In the ui settings" text="Font size" align="center"/>
|
||||
<spacer width="2%" height="20"/>
|
||||
<div layout="horizontal-row" proportion="5" height="100%">
|
||||
<gauge id="font_size" min_value="1" max_value="5" width="60%"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer width="5" height="2%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="showfps"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
|
@ -644,7 +644,7 @@ namespace UserConfigParams
|
||||
&m_video_group, "Generate mipmap for textures using "
|
||||
"high quality method with SSE"));
|
||||
PARAM_PREFIX FloatUserConfigParam m_fonts_size
|
||||
PARAM_DEFAULT( FloatUserConfigParam(2, "fonts_size",
|
||||
PARAM_DEFAULT( FloatUserConfigParam(3, "fonts_size",
|
||||
&m_video_group,"The size of fonts. 0 is the smallest and 6 is the biggest") );
|
||||
|
||||
// ---- Recording
|
||||
|
@ -52,14 +52,17 @@ void override_default_params()
|
||||
case ACONFIGURATION_SCREENSIZE_NORMAL:
|
||||
UserConfigParams::m_multitouch_scale = 1.3f;
|
||||
UserConfigParams::m_multitouch_sensitivity_x = 0.1f;
|
||||
UserConfigParams::m_fonts_size = 5.0f;
|
||||
break;
|
||||
case ACONFIGURATION_SCREENSIZE_LARGE:
|
||||
UserConfigParams::m_multitouch_scale = 1.2f;
|
||||
UserConfigParams::m_multitouch_sensitivity_x = 0.15f;
|
||||
UserConfigParams::m_fonts_size = 5.0f;
|
||||
break;
|
||||
case ACONFIGURATION_SCREENSIZE_XLARGE:
|
||||
UserConfigParams::m_multitouch_scale = 1.1f;
|
||||
UserConfigParams::m_multitouch_sensitivity_x = 0.2f;
|
||||
UserConfigParams::m_fonts_size = 4.0f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -68,9 +71,6 @@ void override_default_params()
|
||||
// Enable screen keyboard
|
||||
UserConfigParams::m_screen_keyboard = 1;
|
||||
|
||||
// Set bigger fonts and buttons
|
||||
UserConfigParams::m_fonts_size = 4.5f;
|
||||
|
||||
// It shouldn't matter, but STK is always run in fullscreen on android
|
||||
UserConfigParams::m_fullscreen = true;
|
||||
|
||||
|
@ -160,6 +160,12 @@ void OptionsScreenUI::init()
|
||||
UserConfigParams::m_minimap_display = 1;
|
||||
}
|
||||
minimap_options->setValue(UserConfigParams::m_minimap_display);
|
||||
|
||||
GUIEngine::SpinnerWidget* font_size = getWidget<GUIEngine::SpinnerWidget>("font_size");
|
||||
assert( font_size != NULL );
|
||||
|
||||
font_size->setValue((int)roundf(UserConfigParams::m_fonts_size));
|
||||
m_prev_font_size = UserConfigParams::m_fonts_size;
|
||||
|
||||
// ---- video modes
|
||||
CheckBoxWidget* splitscreen_method = getWidget<CheckBoxWidget>("split_screen_horizontally");
|
||||
@ -248,6 +254,12 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
||||
assert( minimap_options != NULL );
|
||||
UserConfigParams::m_minimap_display = minimap_options->getValue();
|
||||
}
|
||||
else if (name == "font_size")
|
||||
{
|
||||
GUIEngine::SpinnerWidget* font_size = getWidget<GUIEngine::SpinnerWidget>("font_size");
|
||||
assert( font_size != NULL );
|
||||
UserConfigParams::m_fonts_size = font_size->getValue();
|
||||
}
|
||||
else if (name == "split_screen_horizontally")
|
||||
{
|
||||
CheckBoxWidget* split_screen_horizontally = getWidget<CheckBoxWidget>("split_screen_horizontally");
|
||||
@ -268,6 +280,11 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
||||
|
||||
void OptionsScreenUI::tearDown()
|
||||
{
|
||||
if (m_prev_font_size != UserConfigParams::m_fonts_size)
|
||||
{
|
||||
irr_driver->sameRestart();
|
||||
}
|
||||
|
||||
Screen::tearDown();
|
||||
// save changes when leaving screen
|
||||
user_config->saveConfig();
|
||||
|
@ -35,6 +35,7 @@ class OptionsScreenUI : public GUIEngine::Screen, public GUIEngine::ScreenSingle
|
||||
{
|
||||
OptionsScreenUI();
|
||||
bool m_inited;
|
||||
float m_prev_font_size;
|
||||
|
||||
std::vector<std::string> m_skins;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user