Been learning Defold Engine over the past couple of days.
I see an unwanted behavior on desktop(Linux x86_64, don’t have Windows 11 to check).
When I maximize the game’s window(not full screen), the mouse x,y coordinates are read outside of visible game area?
Is this a bug on Linux desktop or this is the way current Defold Engine works?
Please see screenshot below.
Ok, but Godot Engine does not do the above?
Do other major game engine do the above(like Unreal and Unity) ?
Makes my life harder to see where mouse cursor is on the actual visible game window.
(when the game is maximized)
How do I calculate the correct mouse cursor position when the game’s window is maximized?
The coordinates given in on_input() are in screen space (i.e. relative to the corner of the window). Converting those coordinates into world space requires doing some math with the active camera’s properties, which is all handled by camera.screen_xy_to_world():
Also those grey areas aren’t outside the game area. They’re just the parts of the world that the green MIT sprite doesn’t cover. “Auto Fit” mode on the camera means that resizing the window will show more of the world to fill the empty space.