forked from Mirrorlandia_minetest/minetest
Split gui_scaling to gui_scaling + hud_scaling as those elements need different handling on some devices
This commit is contained in:
parent
d576235409
commit
e201620ee1
@ -132,6 +132,7 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("crosshair_color", "(255,255,255)");
|
settings->setDefault("crosshair_color", "(255,255,255)");
|
||||||
settings->setDefault("crosshair_alpha", "255");
|
settings->setDefault("crosshair_alpha", "255");
|
||||||
settings->setDefault("gui_scaling", "0.75");
|
settings->setDefault("gui_scaling", "0.75");
|
||||||
|
settings->setDefault("hud_scaling", "1.0");
|
||||||
settings->setDefault("mouse_sensitivity", "0.2");
|
settings->setDefault("mouse_sensitivity", "0.2");
|
||||||
settings->setDefault("enable_sound", "true");
|
settings->setDefault("enable_sound", "true");
|
||||||
settings->setDefault("sound_volume", "0.8");
|
settings->setDefault("sound_volume", "0.8");
|
||||||
@ -326,10 +327,10 @@ void set_default_settings(Settings *settings)
|
|||||||
float x_inches = ((double) porting::getDisplaySize().X /
|
float x_inches = ((double) porting::getDisplaySize().X /
|
||||||
(160 * porting::getDisplayDensity()));
|
(160 * porting::getDisplayDensity()));
|
||||||
if (x_inches < 3.5) {
|
if (x_inches < 3.5) {
|
||||||
settings->setDefault("gui_scaling", "0.6");
|
settings->setDefault("hud_scaling", "0.6");
|
||||||
}
|
}
|
||||||
else if (x_inches < 4.5) {
|
else if (x_inches < 4.5) {
|
||||||
settings->setDefault("gui_scaling", "0.7");
|
settings->setDefault("hud_scaling", "0.7");
|
||||||
}
|
}
|
||||||
settings->setDefault("curl_verify_cert","false");
|
settings->setDefault("curl_verify_cert","false");
|
||||||
#else
|
#else
|
||||||
|
12
src/hud.cpp
12
src/hud.cpp
@ -51,7 +51,7 @@ Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
|
|||||||
m_screensize = v2u32(0, 0);
|
m_screensize = v2u32(0, 0);
|
||||||
m_displaycenter = v2s32(0, 0);
|
m_displaycenter = v2s32(0, 0);
|
||||||
m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
|
m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
|
||||||
m_hotbar_imagesize *= g_settings->getFloat("gui_scaling");
|
m_hotbar_imagesize *= g_settings->getFloat("hud_scaling");
|
||||||
m_padding = m_hotbar_imagesize / 12;
|
m_padding = m_hotbar_imagesize / 12;
|
||||||
|
|
||||||
const video::SColor hbar_color(255, 255, 255, 255);
|
const video::SColor hbar_color(255, 255, 255, 255);
|
||||||
@ -341,15 +341,15 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture,
|
|||||||
if (size == v2s32()) {
|
if (size == v2s32()) {
|
||||||
dstd = srcd;
|
dstd = srcd;
|
||||||
} else {
|
} else {
|
||||||
dstd.Height = size.Y * g_settings->getFloat("gui_scaling") *
|
dstd.Height = size.Y * g_settings->getFloat("hud_scaling") *
|
||||||
porting::getDisplayDensity();
|
porting::getDisplayDensity();
|
||||||
dstd.Width = size.X * g_settings->getFloat("gui_scaling") *
|
dstd.Width = size.X * g_settings->getFloat("hud_scaling") *
|
||||||
porting::getDisplayDensity();
|
porting::getDisplayDensity();
|
||||||
|
|
||||||
offset.X *= g_settings->getFloat("gui_scaling") *
|
offset.X *= g_settings->getFloat("hud_scaling") *
|
||||||
porting::getDisplayDensity();
|
porting::getDisplayDensity();
|
||||||
|
|
||||||
offset.Y *= g_settings->getFloat("gui_scaling") *
|
offset.Y *= g_settings->getFloat("hud_scaling") *
|
||||||
porting::getDisplayDensity();
|
porting::getDisplayDensity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ void Hud::drawSelectionBoxes(std::vector<aabb3f> &hilightboxes) {
|
|||||||
void Hud::resizeHotbar() {
|
void Hud::resizeHotbar() {
|
||||||
if (m_screensize != porting::getWindowSize()) {
|
if (m_screensize != porting::getWindowSize()) {
|
||||||
m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
|
m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
|
||||||
m_hotbar_imagesize *= g_settings->getFloat("gui_scaling");
|
m_hotbar_imagesize *= g_settings->getFloat("hud_scaling");
|
||||||
m_padding = m_hotbar_imagesize / 12;
|
m_padding = m_hotbar_imagesize / 12;
|
||||||
m_screensize = porting::getWindowSize();
|
m_screensize = porting::getWindowSize();
|
||||||
m_displaycenter = v2s32(m_screensize.X/2,m_screensize.Y/2);
|
m_displaycenter = v2s32(m_screensize.X/2,m_screensize.Y/2);
|
||||||
|
@ -156,7 +156,7 @@ void TouchScreenGUI::initButton(touch_gui_button_id id, rect<s32> button_rect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int getMaxControlPadSize(float density) {
|
static int getMaxControlPadSize(float density) {
|
||||||
return 200 * density * g_settings->getFloat("gui_scaling");
|
return 200 * density * g_settings->getFloat("hud_scaling");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
||||||
|
Loading…
Reference in New Issue
Block a user