1
0
Fork 0
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:
Gregor Parzefall 2023-07-07 21:42:43 +02:00 committed by GitHub
parent 078bd95a49
commit 0218963f1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 27 deletions

View file

@ -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;