Split gui_scaling to gui_scaling + hud_scaling as those elements need different handling on some devices

master
sapier 2015-01-07 00:10:46 +01:00
parent d576235409
commit e201620ee1
3 changed files with 10 additions and 9 deletions

View File

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

View File

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

View File

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