Skip to content

Commit

Permalink
GUI: Automatic scaling of checkboxes and scrollbars (minetest#13666)
Browse files Browse the repository at this point in the history
Mainly helpful on high-DPI screens or when 'gui_scaling' is changed
  • Loading branch information
SmallJoker authored and Wuzzy2 committed Jul 31, 2023
1 parent 910fb3c commit 122b960
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/client/clientlauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
skin->setColor(gui::EGDC_3D_SHADOW, video::SColor(255, 0, 0, 0));
skin->setColor(gui::EGDC_HIGH_LIGHT, video::SColor(255, 70, 120, 50));
skin->setColor(gui::EGDC_HIGH_LIGHT_TEXT, video::SColor(255, 255, 255, 255));
#ifdef HAVE_TOUCHSCREENGUI
float density = RenderingEngine::getDisplayDensity();

float density = rangelim(g_settings->getFloat("gui_scaling"), 0.5, 20) *
RenderingEngine::getDisplayDensity();
skin->setSize(gui::EGDS_CHECK_BOX_WIDTH, (s32)(17.0f * density));
skin->setSize(gui::EGDS_SCROLLBAR_SIZE, (s32)(14.0f * density));
skin->setSize(gui::EGDS_WINDOW_BUTTON_WIDTH, (s32)(15.0f * density));
Expand All @@ -167,7 +168,7 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
skin->setIcon(gui::EGDI_CHECK_BOX_CHECKED, sprite_id);
}
}
#endif

g_fontengine = new FontEngine(guienv);
FATAL_ERROR_IF(g_fontengine == NULL, "Font engine creation failed.");

Expand Down

0 comments on commit 122b960

Please sign in to comment.