mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix max_formspec_size not taking gui_scaling into account (#13493)
This commit is contained in:
parent
078bd95a49
commit
0218963f1b
3 changed files with 34 additions and 27 deletions
|
@ -928,25 +928,22 @@ int ModApiMainMenu::l_get_window_info(lua_State *L)
|
|||
lua_newtable(L);
|
||||
int top = lua_gettop(L);
|
||||
|
||||
const v2u32 &window_size = RenderingEngine::getWindowSize();
|
||||
f32 density = RenderingEngine::getDisplayDensity();
|
||||
f32 gui_scaling = g_settings->getFloat("gui_scaling") * density;
|
||||
f32 hud_scaling = g_settings->getFloat("hud_scaling") * density;
|
||||
auto info = ClientDynamicInfo::getCurrent();
|
||||
|
||||
lua_pushstring(L, "size");
|
||||
push_v2u32(L, window_size);
|
||||
push_v2u32(L, info.render_target_size);
|
||||
lua_settable(L, top);
|
||||
|
||||
lua_pushstring(L, "max_formspec_size");
|
||||
push_v2f(L, ClientDynamicInfo::calculateMaxFSSize(window_size));
|
||||
push_v2f(L, info.max_fs_size);
|
||||
lua_settable(L, top);
|
||||
|
||||
lua_pushstring(L, "real_gui_scaling");
|
||||
lua_pushnumber(L, gui_scaling);
|
||||
lua_pushnumber(L, info.real_gui_scaling);
|
||||
lua_settable(L, top);
|
||||
|
||||
lua_pushstring(L, "real_hud_scaling");
|
||||
lua_pushnumber(L, hud_scaling);
|
||||
lua_pushnumber(L, info.real_hud_scaling);
|
||||
lua_settable(L, top);
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue