aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2015-01-07 00:10:46 +0100
committersapier <Sapier at GMX dot net>2015-01-09 14:31:33 +0100
commite201620ee1051545ed7856fb18f805c67adccc85 (patch)
treeec42ff5a05e75a8c48de59cb17c92950442d1495
parentd576235409c1c21c25167ccd611fc847e9d23cb8 (diff)
downloadminetest-e201620ee1051545ed7856fb18f805c67adccc85.tar.gz
minetest-e201620ee1051545ed7856fb18f805c67adccc85.tar.bz2
minetest-e201620ee1051545ed7856fb18f805c67adccc85.zip
Split gui_scaling to gui_scaling + hud_scaling as those elements need different handling on some devices
-rw-r--r--src/defaultsettings.cpp5
-rw-r--r--src/hud.cpp12
-rw-r--r--src/touchscreengui.cpp2
3 files changed, 10 insertions, 9 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 3811a63a1..932e8e885 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -132,6 +132,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("crosshair_color", "(255,255,255)");
settings->setDefault("crosshair_alpha", "255");
settings->setDefault("gui_scaling", "0.75");
+ settings->setDefault("hud_scaling", "1.0");
settings->setDefault("mouse_sensitivity", "0.2");
settings->setDefault("enable_sound", "true");
settings->setDefault("sound_volume", "0.8");
@@ -326,10 +327,10 @@ void set_default_settings(Settings *settings)
float x_inches = ((double) porting::getDisplaySize().X /
(160 * porting::getDisplayDensity()));
if (x_inches < 3.5) {
- settings->setDefault("gui_scaling", "0.6");
+ settings->setDefault("hud_scaling", "0.6");
}
else if (x_inches < 4.5) {
- settings->setDefault("gui_scaling", "0.7");
+ settings->setDefault("hud_scaling", "0.7");
}
settings->setDefault("curl_verify_cert","false");
#else
diff --git a/src/hud.cpp b/src/hud.cpp
index 59e8b8f27..a74d926d7 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -51,7 +51,7 @@ Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
m_screensize = v2u32(0, 0);
m_displaycenter = v2s32(0, 0);
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;
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()) {
dstd = srcd;
} else {
- dstd.Height = size.Y * g_settings->getFloat("gui_scaling") *
+ dstd.Height = size.Y * g_settings->getFloat("hud_scaling") *
porting::getDisplayDensity();
- dstd.Width = size.X * g_settings->getFloat("gui_scaling") *
+ dstd.Width = size.X * g_settings->getFloat("hud_scaling") *
porting::getDisplayDensity();
- offset.X *= g_settings->getFloat("gui_scaling") *
+ offset.X *= g_settings->getFloat("hud_scaling") *
porting::getDisplayDensity();
- offset.Y *= g_settings->getFloat("gui_scaling") *
+ offset.Y *= g_settings->getFloat("hud_scaling") *
porting::getDisplayDensity();
}
@@ -479,7 +479,7 @@ void Hud::drawSelectionBoxes(std::vector<aabb3f> &hilightboxes) {
void Hud::resizeHotbar() {
if (m_screensize != porting::getWindowSize()) {
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_screensize = porting::getWindowSize();
m_displaycenter = v2s32(m_screensize.X/2,m_screensize.Y/2);
diff --git a/src/touchscreengui.cpp b/src/touchscreengui.cpp
index 065c7a392..a2c981cff 100644
--- a/src/touchscreengui.cpp
+++ b/src/touchscreengui.cpp
@@ -156,7 +156,7 @@ void TouchScreenGUI::initButton(touch_gui_button_id id, rect<s32> button_rect,
}
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)