Incorrect cursor position when fullscreen. #279
Comments
Not sure about the coordinates being wrong, but in any case, PointToClient() creates garbage. And you will be calling this once every update. So in the end, I used interop: [StructLayout(LayoutKind.Sequential)] public POINT(int x, int y) [DllImport("user32.dll")] [DllImport("user32.dll", SetLastError = true)] |
Thanks for the report, indeed, the code behind PointToClient is bad. Will try to see if I can fix the coordinates problem |
Related question: Is there a reason why the toolkit Mouse position returns floats between 0 and 1? Wouldn't it be easier to just return the cursor position as is? That way the user wont need to multiply the floats back to correct x/y values? |
I think this is a relative layout, and will help you when f.e. the elements size changes. 0.5 will still be center. |
I realize that, but many other high-level libraries do it in this way. I assume for the majority it would be used as just getting straight x/y positions. |
…tching to fullscreen. Remove call to PointToClient to avoid GC
This should be fixed by latest commit. Concerning position in the range [0, 1], well, it is a convention. I found more practical to use [0, 1] as it directly maps to a texcoord and can be more friendly to different screen ratio. |
Looks like internal cursor positions are getting obtained from
var p = control.PointToClient(Cursor.Position);
which does not seem to work correctly when a Windows Desktop toolkit game is in fullscreen (the mouse cannot cover the whole screen).
What would be the best solution? Checking whether the game is in fullscreen or not (if true then just use Cursor.Position instead?), or are there any other methods? I'm not sure what happens to the underlying form when the game goes fullscreen.
This is the last "bug" I have encounted for the toolkit.
The text was updated successfully, but these errors were encountered: