summaryrefslogtreecommitdiff
path: root/src/hud.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-04-27 22:44:37 +0200
committersapier <Sapier at GMX dot net>2014-04-27 22:44:37 +0200
commit65016c880c88cdc9a6e2370aadbc496b742db393 (patch)
treea71a08135ac82d168c2551e6ae70530565de7544 /src/hud.cpp
parent0d6e4ef5f38049e86457287fa638a9b81c4ff623 (diff)
downloadminetest-65016c880c88cdc9a6e2370aadbc496b742db393.tar.gz
minetest-65016c880c88cdc9a6e2370aadbc496b742db393.tar.bz2
minetest-65016c880c88cdc9a6e2370aadbc496b742db393.zip
Fix rounding issue of hud dpi on some machines
Diffstat (limited to 'src/hud.cpp')
-rw-r--r--src/hud.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hud.cpp b/src/hud.cpp
index f5f959903..bbec4489e 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -49,7 +49,7 @@ Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
m_screensize = v2u32(0, 0);
m_displaycenter = v2s32(0, 0);
- m_hotbar_imagesize = HOTBAR_IMAGE_SIZE * porting::getDisplayDensity();
+ m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
m_padding = m_hotbar_imagesize / 12;
const video::SColor hbar_color(255, 255, 255, 255);
@@ -436,7 +436,7 @@ void Hud::drawSelectionBoxes(std::vector<aabb3f> &hilightboxes) {
void Hud::resizeHotbar() {
if (m_screensize != porting::getWindowSize()) {
- m_hotbar_imagesize = porting::getDisplayDensity() * HOTBAR_IMAGE_SIZE;
+ m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
m_padding = m_hotbar_imagesize / 12;
m_screensize = porting::getWindowSize();
m_displaycenter = v2s32(m_screensize.X/2,m_screensize.Y/2);