1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-23 16:08:51 -05:00

Fix rounding issue of hud dpi on some machines

This commit is contained in:
sapier 2014-04-27 22:44:37 +02:00
parent 0d6e4ef5f3
commit 65016c880c

View File

@ -49,7 +49,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 = HOTBAR_IMAGE_SIZE * porting::getDisplayDensity(); m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
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);
@ -436,7 +436,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 = porting::getDisplayDensity() * HOTBAR_IMAGE_SIZE; m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
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);