mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Remove excessive touchscreengui.h includes (#14466)
This commit is contained in:
parent
61a5733692
commit
c8b615acc9
8 changed files with 115 additions and 86 deletions
|
@ -20,11 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#pragma once
|
||||
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#ifndef SERVER
|
||||
#include "settings.h"
|
||||
#include "client/renderingengine.h"
|
||||
#include "gui/touchscreengui.h"
|
||||
#endif
|
||||
|
||||
|
||||
struct ClientDynamicInfo
|
||||
|
@ -44,32 +39,9 @@ public:
|
|||
}
|
||||
|
||||
#ifndef SERVER
|
||||
static ClientDynamicInfo getCurrent() {
|
||||
v2u32 screen_size = RenderingEngine::getWindowSize();
|
||||
f32 density = RenderingEngine::getDisplayDensity();
|
||||
f32 gui_scaling = g_settings->getFloat("gui_scaling", 0.5f, 20.0f);
|
||||
f32 hud_scaling = g_settings->getFloat("hud_scaling", 0.5f, 20.0f);
|
||||
f32 real_gui_scaling = gui_scaling * density;
|
||||
f32 real_hud_scaling = hud_scaling * density;
|
||||
bool touch_controls = g_touchscreengui;
|
||||
|
||||
return {
|
||||
screen_size, real_gui_scaling, real_hud_scaling,
|
||||
ClientDynamicInfo::calculateMaxFSSize(screen_size, gui_scaling),
|
||||
touch_controls
|
||||
};
|
||||
}
|
||||
#endif
|
||||
static ClientDynamicInfo getCurrent();
|
||||
|
||||
private:
|
||||
#ifndef SERVER
|
||||
static v2f32 calculateMaxFSSize(v2u32 render_target_size, f32 gui_scaling) {
|
||||
f32 factor = (g_settings->getBool("enable_touch") ? 10 : 15) / gui_scaling;
|
||||
f32 ratio = (f32)render_target_size.X / (f32)render_target_size.Y;
|
||||
if (ratio < 1)
|
||||
return { factor, factor / ratio };
|
||||
else
|
||||
return { factor * ratio, factor };
|
||||
}
|
||||
static v2f32 calculateMaxFSSize(v2u32 render_target_size, f32 gui_scaling);
|
||||
#endif
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue