From a616b37f6ad8c6e6939d89efeee35b7de180bec5 Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Thu, 12 Oct 2023 01:08:27 +0200 Subject: [PATCH] Fix setMouse with letter-boxing --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 97b395063..9d46478ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -347,8 +347,8 @@ bool mousePressed(mouse::Button button) { void setMouse(const jngl::Vec2 position) { pWindow->SetMouse( - static_cast(std::lround((position.x + getScreenWidth() / 2) * getScaleFactor())), - static_cast(std::lround((position.y + getScreenHeight() / 2) * getScaleFactor()))); + static_cast(std::lround(position.x * getScaleFactor() + pWindow->getWidth() / 2.)), + static_cast(std::lround(position.y * getScaleFactor() + pWindow->getHeight() / 2.))); } void setRelativeMouseMode(const bool relative) {