Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse Input coordinates are wrong in fullscreen when hiDPI mode is enabled #64705

Closed
BigZaphod opened this issue Aug 21, 2022 · 4 comments
Closed

Comments

@BigZaphod
Copy link

Godot version

v3.5.stable.official [991bb6a]

System information

macOS 12.5.1 (21G83), Apple M1 Max MacBook Pro

Issue description

I was attempting to implement a simple dragging mechanic and noticed it worked fine in windowed mode but the mouse input coordinates went all wrong after making the game window fullscreen. Here's a video showing what happens on my machine when I run the attached sample project:

Screen.Recording.2022-08-21.at.3.06.47.PM.mov

Steps to reproduce

Run the attached project on macOS (no idea if this also happens on Windows) and then click and drag from the Godot icon. It should drag out a smaller godot icon that follows the mouse around and disappears when you let go of the button.

If I disable the "Allow hiDPI" project setting, then it appears to work fine in fullscreen.

Minimal reproduction project

Godot HighDPI Input Bug.zip

@Calinou
Copy link
Member

Calinou commented Aug 21, 2022

Duplicate of #34805.

The project uses the 2d stretch mode, so you likely need to multiply/divide mouse coordinates by the automatically determined scale factor.

@Calinou
Copy link
Member

Calinou commented Aug 21, 2022

You likely need to multiply/divide mouse coordinates by the automatically determined scale factor, like this:

Godot HighDPI Input Bug.2.zip

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2022
@BigZaphod
Copy link
Author

Duplicate of #34805.

The project uses the 2d stretch mode, so you likely need to multiply/divide mouse coordinates by the automatically determined scale factor.

I appreciate the workaround, but why in the world should game code have to do this? Isn't handling this kind of stuff exactly what using an engine is for?

@Calinou
Copy link
Member

Calinou commented Aug 21, 2022

I appreciate the workaround, but why in the world should game code have to do this? Isn't handling this kind of stuff exactly what using an engine is for?

There are likely some cases where having the unscaled mouse coordinates is useful, but I don't know which ones exactly. Scaling mouse coordinates automatically would also break all projects that rely on the current coordinate system, so this can only be considered for 4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants