Skip to content

Commit

Permalink
Rename *_scaling to real_*_scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed May 22, 2022
1 parent 395052b commit af973ac
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions doc/lua_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4748,11 +4748,11 @@ Utilities

-- GUI Scaling multiplier
-- Equal to the setting `gui_scaling` multiplied by `dpi / 96`
gui_scaling = 1,
real_gui_scaling = 1,

-- HUD Scaling multiplier
-- Equal to the setting `hud_scaling` multiplied by `dpi / 96`
hud_scaling = 1,
real_hud_scaling = 1,
}

* `minetest.mkdir(path)`: returns success.
Expand Down
4 changes: 2 additions & 2 deletions games/devtest/mods/testfullscreenfs/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local function calculate_max_fs_size(window)
return {
x = window.size.x / (0.5555 * 96 * window.gui_scaling),
y = window.size.y / (0.5555 * 96 * window.gui_scaling),
x = window.size.x / (0.5555 * 96 * window.real_gui_scaling),
y = window.size.y / (0.5555 * 96 * window.real_gui_scaling),
}
end

Expand Down
4 changes: 2 additions & 2 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,8 +1373,8 @@ void Client::sendUpdateClientInfo(const ClientDynamicInfo& info)
{
NetworkPacket pkt(TOSERVER_UPDATE_CLIENT_INFO, 4*2 + 4 + 4);
pkt << (u32)info.render_target_size.X << (u32)info.render_target_size.Y;
pkt << info.gui_scaling;
pkt << info.hud_scaling;
pkt << info.real_gui_scaling;
pkt << info.real_hud_scaling;

Send(&pkt);
}
Expand Down
8 changes: 4 additions & 4 deletions src/clientdynamicinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
struct ClientDynamicInfo
{
v2u32 render_target_size;
f32 gui_scaling;
f32 hud_scaling;
f32 real_gui_scaling;
f32 real_hud_scaling;

bool equal(const ClientDynamicInfo &other) const {
return render_target_size == other.render_target_size &&
abs(gui_scaling - other.gui_scaling) < 0.001f &&
abs(hud_scaling - other.hud_scaling) < 0.001f;
abs(real_gui_scaling - other.real_gui_scaling) < 0.001f &&
abs(real_hud_scaling - other.real_hud_scaling) < 0.001f;
}
};
4 changes: 2 additions & 2 deletions src/network/serverpackethandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1846,8 +1846,8 @@ void Server::handleCommand_UpdateClientInfo(NetworkPacket *pkt)
ClientDynamicInfo info;
*pkt >> info.render_target_size.X;
*pkt >> info.render_target_size.Y;
*pkt >> info.gui_scaling;
*pkt >> info.hud_scaling;
*pkt >> info.real_gui_scaling;
*pkt >> info.real_hud_scaling;

session_t peer_id = pkt->getPeerId();
RemoteClient *client = getClient(peer_id, CS_Invalid);
Expand Down
8 changes: 4 additions & 4 deletions src/script/lua_api/l_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ int ModApiServer::l_get_player_window_information(lua_State *L)
push_v2u32(L, dynamic->render_target_size);
lua_settable(L, dyn_table);

lua_pushstring(L, "gui_scaling");
lua_pushnumber(L, dynamic->gui_scaling);
lua_pushstring(L, "real_gui_scaling");
lua_pushnumber(L, dynamic->real_gui_scaling);
lua_settable(L, dyn_table);

lua_pushstring(L, "hud_scaling");
lua_pushnumber(L, dynamic->hud_scaling);
lua_pushstring(L, "real_hud_scaling");
lua_pushnumber(L, dynamic->real_hud_scaling);
lua_settable(L, dyn_table);
}

Expand Down

0 comments on commit af973ac

Please sign in to comment.