diff --git a/binaries/data/mods/public/gui/session/input.js b/binaries/data/mods/public/gui/session/input.js index fab0f9783e..03fc47887d 100644 --- a/binaries/data/mods/public/gui/session/input.js +++ b/binaries/data/mods/public/gui/session/input.js @@ -423,7 +423,7 @@ function updateBandbox(bandbox, ev, hidden) let scale = +Engine.ConfigDB_GetValue("user", "gui.scale"); - bandbox.size = new GUISize(x0 * scale, y0 * scale, x1 * scale, y1 * scale); + bandbox.size = new GUISize(x0 / scale, y0 / scale, x1 / scale, y1 / scale); bandbox.hidden = hidden; return [x0, y0, x1, y1]; diff --git a/source/graphics/TextRenderer.cpp b/source/graphics/TextRenderer.cpp index 9f7bb00bbe..335d3ee59f 100644 --- a/source/graphics/TextRenderer.cpp +++ b/source/graphics/TextRenderer.cpp @@ -37,8 +37,8 @@ CTextRenderer::CTextRenderer(const CShaderProgramPtr& shader) : void CTextRenderer::ResetTransform() { - float xres = g_xres * g_GuiScale; - float yres = g_yres * g_GuiScale; + float xres = g_xres / g_GuiScale; + float yres = g_yres / g_GuiScale; m_Transform.SetIdentity(); m_Transform.Scale(1.0f, -1.f, 1.0f); diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 1e62fd4be4..9cfbec2a81 100644 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -93,7 +93,7 @@ InReaction CGUI::HandleEvent(const SDL_Event_* ev) // Yes the mouse position is stored as float to avoid // constant conversions when operating in a // float-based environment. - m_MousePos = CPos((float)ev->ev.motion.x * g_GuiScale, (float)ev->ev.motion.y * g_GuiScale); + m_MousePos = CPos((float)ev->ev.motion.x / g_GuiScale, (float)ev->ev.motion.y / g_GuiScale); SGUIMessage msg(GUIM_MOUSE_MOTION); GUI::RecurseObject(GUIRR_HIDDEN | GUIRR_GHOST, m_BaseObject, @@ -120,7 +120,7 @@ InReaction CGUI::HandleEvent(const SDL_Event_* ev) CPos oldMousePos = m_MousePos; if (ev->ev.type == SDL_MOUSEBUTTONDOWN || ev->ev.type == SDL_MOUSEBUTTONUP) { - m_MousePos = CPos((float)ev->ev.button.x * g_GuiScale, (float)ev->ev.button.y * g_GuiScale); + m_MousePos = CPos((float)ev->ev.button.x / g_GuiScale, (float)ev->ev.button.y / g_GuiScale); } // Only one object can be hovered @@ -812,10 +812,10 @@ void CGUI::DrawText(SGUIText& Text, const CColor& DefaultColor, const CPos& pos, { glEnable(GL_SCISSOR_TEST); glScissor( - clipping.left / g_GuiScale, - g_yres - clipping.bottom / g_GuiScale, - clipping.GetWidth() / g_GuiScale, - clipping.GetHeight() / g_GuiScale); + clipping.left * g_GuiScale, + g_yres - clipping.bottom * g_GuiScale, + clipping.GetWidth() * g_GuiScale, + clipping.GetHeight() * g_GuiScale); } CTextRenderer textRenderer(tech->GetShader()); diff --git a/source/gui/CInput.cpp b/source/gui/CInput.cpp index 3d7255e72a..734cb59f28 100644 --- a/source/gui/CInput.cpp +++ b/source/gui/CInput.cpp @@ -1187,10 +1187,10 @@ void CInput::Draw() { glEnable(GL_SCISSOR_TEST); glScissor( - cliparea.left / g_GuiScale, - g_yres - cliparea.bottom / g_GuiScale, - cliparea.GetWidth() / g_GuiScale, - cliparea.GetHeight() / g_GuiScale); + cliparea.left * g_GuiScale, + g_yres - cliparea.bottom * g_GuiScale, + cliparea.GetWidth() * g_GuiScale, + cliparea.GetHeight() * g_GuiScale); } // These are useful later. diff --git a/source/gui/GUIutil.cpp b/source/gui/GUIutil.cpp index 11aea048f2..6e3d9db25b 100644 --- a/source/gui/GUIutil.cpp +++ b/source/gui/GUIutil.cpp @@ -263,8 +263,8 @@ bool __ParseString(const CStrW& UNUSED(Value), CGUISeries& UNUSED(Ou CMatrix3D GetDefaultGuiMatrix() { - float xres = g_xres * g_GuiScale; - float yres = g_yres * g_GuiScale; + float xres = g_xres / g_GuiScale; + float yres = g_yres / g_GuiScale; CMatrix3D m; m.SetIdentity(); diff --git a/source/gui/IGUIObject.cpp b/source/gui/IGUIObject.cpp index e0efbf8701..9113b4ab19 100644 --- a/source/gui/IGUIObject.cpp +++ b/source/gui/IGUIObject.cpp @@ -313,7 +313,7 @@ void IGUIObject::UpdateCachedSize() if (absolute == false && m_pParent && !IsRootObject()) m_CachedActualSize = ca.GetClientArea(m_pParent->m_CachedActualSize); else - m_CachedActualSize = ca.GetClientArea(CRect(0.f, 0.f, g_xres * g_GuiScale, g_yres * g_GuiScale)); + m_CachedActualSize = ca.GetClientArea(CRect(0.f, 0.f, g_xres / g_GuiScale, g_yres / g_GuiScale)); // In a few cases, GUI objects have to resize to fill the screen // but maintain a constant aspect ratio. diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp index 2499258afc..ab39655a30 100644 --- a/source/gui/MiniMap.cpp +++ b/source/gui/MiniMap.cpp @@ -283,10 +283,10 @@ void CMiniMap::DrawViewRect(CMatrix3D transform) // Enable Scissoring to restrict the rectangle to only the minimap. glScissor( - m_CachedActualSize.left / g_GuiScale, - g_Renderer.GetHeight() - m_CachedActualSize.bottom / g_GuiScale, - width / g_GuiScale, - height / g_GuiScale); + m_CachedActualSize.left * g_GuiScale, + g_Renderer.GetHeight() - m_CachedActualSize.bottom * g_GuiScale, + width * g_GuiScale, + height * g_GuiScale); glEnable(GL_SCISSOR_TEST); glLineWidth(2.0f); diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index 09ea6fe27a..14c2e181ed 100644 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -86,7 +86,7 @@ void CConsole::SetSize(float X, float Y, float W, float H) void CConsole::UpdateScreenSize(int w, int h) { float height = h * 0.6f; - SetSize(0, 0, w * g_GuiScale, height * g_GuiScale); + SetSize(0, 0, w / g_GuiScale, height / g_GuiScale); } diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index 8b42e76444..c0d71f8377 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -281,7 +281,7 @@ void Render() CStrW cursorName = g_CursorName; if (cursorName.empty()) { - cursor_draw(g_VFS, NULL, g_mouse_x, g_yres-g_mouse_y, 1.0 / g_GuiScale, false); + cursor_draw(g_VFS, NULL, g_mouse_x, g_yres-g_mouse_y, g_GuiScale, false); } else { @@ -306,7 +306,7 @@ void Render() #if OS_ANDROID #warning TODO: cursors for Android #else - if (cursor_draw(g_VFS, cursorName.c_str(), g_mouse_x, g_yres-g_mouse_y, 1.0 / g_GuiScale, forceGL) < 0) + if (cursor_draw(g_VFS, cursorName.c_str(), g_mouse_x, g_yres-g_mouse_y, g_GuiScale, forceGL) < 0) LOGWARNING("Failed to draw cursor '%s'", utf8_from_wstring(cursorName)); #endif