summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-10 10:22:31 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-10 10:36:22 +0200
commit8abaa77121d12f8a59737c03d581e00b7dd90b16 (patch)
treef3e40892f62d3a5ebd24c41e0ac03a0e2fa77476 /src/gui/gui.cpp
parent6f102137fc36447b7ce29fd065581a1f6f996fc6 (diff)
downloadmana-8abaa77121d12f8a59737c03d581e00b7dd90b16.tar.gz
mana-8abaa77121d12f8a59737c03d581e00b7dd90b16.tar.bz2
mana-8abaa77121d12f8a59737c03d581e00b7dd90b16.tar.xz
mana-8abaa77121d12f8a59737c03d581e00b7dd90b16.zip
Fixed the scaling of the custom cursor
It appears that either SDL or the system is already taking care of scaling the cursor to the display scale (observed on both macOS and Wayland). Hence, we should only scale the cursor by the user scale and not by both. Follow-up to 6eca1b485dba7355d827745284ed2f0072f9e370.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 93037db2..92dab954 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -56,7 +56,7 @@ gcn::Font *monoFont = nullptr;
bool Gui::debugDraw;
Gui::Gui(Graphics *graphics)
- : mCustomCursorScale(graphics->getScale())
+ : mCustomCursorScale(Client::getVideo().settings().scale())
{
logger->log("Initializing GUI...");
// Set graphics
@@ -186,13 +186,14 @@ void Gui::event(Event::Channel channel, const Event &event)
bool Gui::videoResized(int width, int height)
{
- const float scale = static_cast<Graphics*>(mGraphics)->getScale();
+ const float graphicsScale = static_cast<Graphics*>(mGraphics)->getScale();
+ const float userScale = Client::getVideo().settings().scale();
- TrueTypeFont::updateFontScale(scale);
+ TrueTypeFont::updateFontScale(graphicsScale);
- if (mCustomCursorScale != scale)
+ if (mCustomCursorScale != userScale)
{
- mCustomCursorScale = scale;
+ mCustomCursorScale = userScale;
loadCustomCursors();
updateCursor();
}