Full Screen Visible Mouse Coordinates off.

When I use full screen mode, my visible mouse coordinates are inaccurate.
I’m using Myra for my UI. Basically when I hover over the play button on my menu, it’s showing the button below highlighted in its hover colour.

Outside of full screen mode, I don’t have this issue.

How do I fix this?

Does your game’s screen resolution match your desktop resolution? If not, you’ll have to convert the mouse position to your game’s world scale.

In Hardare Fullscreen Mode (there is a flag for that) the games resolution should match the mouse resolution.

Everything else - being either windowed or non-hardware fullscreen (which is a borderless window then) - will report mouse coordinates in your Desktops Resolution and - as mentioned above - the UI Handler has to scale that to the resolution the UI is running on.

Or you Input Handler in case you do some scaling on your own.

Can’t tell about Myra and how it’s handled there as I use my own UI - wonder a bit, that it’s not handling it out of the box tho, as it should’ve all information available (except you do your own scaling on top)

Looks like I’ll have to convert the mouse position.

Oddly though, I have it currently set to GraphicsAdapter.DefaultAdapter.CurrentDisplayMode .Width/Height, but for some reason the fullscreen mode still looks bordered - it doesn’t reach the sides of the screen at all. Is there a reason for that?

Is it the same as the issue i once had?

This seems like the same problem I have an open issue for on Github: [DirectX] Mouse location reporting in hardware fullscreen mode is at first incorrect and inconsistent with DesktopGL · Issue #7654 · MonoGame/MonoGame · GitHub

There was a workaround provided by another user in that issue: add the following code to your Initialize method:

graphics.HardwareModeSwitch = false;
graphics.IsFullScreen = true;
graphics.HardwareModeSwitch = true;

The problem seems to be related in some way to the Windows taskbar.

@boot That indeed seems to be the same issue. I’m guessing your taskbar was 20 pixels tall at the time.

I’m not sure, I’ve actually never experienced that one myself. I’ve seen issues where a window that’s a larger size than the desktop it’s placed on reports incorrect mouse positions, but I think that’s an issue somewhere in the Windows API because a product I used to work on that was built in the 90’s had the same issue.

Sorry I can’t be of any help on that part.