Jump to content

Fullscreen and mouse position issue


AggrorJorn
 Share

Recommended Posts

So I ran a my winter game fullscreen for the first time and I noticed that my mouse position was of in comparison to the the UI. At first I though this was a problem with FlowGUI, but after some testing I saw some weird results when looking at the mouse position,

 

I ran 2 test where I would print the mouse x coordinate when it was somewhere around the horizontal center of the screen. When using Titlebar + fulscreen, the mouse x returned: 1279 (It is a UHD screen so that value is correct).

 

Then I proceeded to do the same thing with just Fulscreen. Now the center mouse x gives back the value: 1022.

 

Is this a bug or am doing something wrong here?

Link to comment
Share on other sites

To be honest, I don't understand the problem. You're talking about both vertical centering, including the titlebar and also horizontal centering (mouse x) so I'm confused. Maybe an image and a little code would help. That said, I assume you know that context and window return different widths and heights (not sure if you're using both).

Link to comment
Share on other sites

Sorry my mistake, I meant horizontal.

  • My monitor has a resolution of 2560 x 1440.
  • So the middle X mouse position would be 1280.
  • When using Titlebar + FullScreen the value is around 1280. So that is correct.
  • When using only FullScreen the value is 1022. Meaning the width of the screen would be around 2040, which is incorrect.
  • I am aware of the small difference between context and window but these values are way off.

  • Upvote 1
Link to comment
Share on other sites

I have a monitor resolution of 1920x1080, tested this on windows 10

 

Window is created 1920x1080 resolution no fullscreen, the windows is much bigger then the actual screen it continues to the right like another 1/4 of the screen.

Width reported is 1904.

 

I can see this with Alt-Space-M windows shortcut that let me move the window.

When i go fullscreen is the same the right part of my game interface is not visible.

Fullscreen width reported is 1920.

 

Might be something similar to what was reported earlier

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

-------------------------windowed fullscreen

Context::GetWidth() 1904 1920

Window::GetWidth() 1920 1920

 

Context::GetHeight() 1041 1080

Window::GetHeight() 1080 1080

 

Mouse cursor width 960 height 540, looks ok.

But its not, cursor is way off the middle of the physical screen.

 

I will try on another computer i might find one with windows 7.

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

This is the SetMousePosition function on Windows:

	void Window::SetMousePosition(const float x, const float y)

{

POINT point;

point.x = Math::Round(x);

point.y = Math::Round(y);

ClientToScreen(hwnd, &point);

SetCursorPos(point.x, point.y);

}

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Adding more info:

https://msdn.microsoft.com/en-us/library/windows/desktop/ee671605(v=vs.85).aspx

 

Default = 96

 

Note By default, the DWM does not perform scaling for non-dpi-aware applications when the user sets the dpi to 120, but does perform scaling when the dpi is set to a custom value of 144 or higher. However, the user can override the default behavior.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The problem is not the mouse coordinates. The problem is when you create a 1920x1080 fullscreen it is creating a larger window. The mouse is still being centered on the center of the window, but the window extends beyond the desktop edges.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

GetGraphicsMode() is spitting out the regular unscaled modes:

320 x 200

320 x 240

400 x 300

512 x 384

640 x 400

640 x 480

720 x 480

720 x 576

800 x 600

1024 x 768

1152 x 864

1280 x 600

1280 x 720

1280 x 768

1280 x 800

1280 x 960

1280 x 1024

1360 x 768

1366 x 768

1400 x 1050

1440 x 900

1600 x 900

1680 x 1050

1920 x 1080

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

These commands have no effect:

SetProcessDPIAware()

SetProcessDpiAwareness(PROCESS_DPI_AWARENESS::PROCESS_SYSTEM_DPI_AWARE)

SetProcessDpiAwareness(PROCESS_DPI_AWARENESS::PROCESS_DPI_UNAWARE)

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...