Cursor coordinates off during resolution change - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Cursor coordinates off during resolution change (/thread-5151.html)
Cursor coordinates off during resolution change - akb825 - Aug 19, 2005 10:53 AM
So far I have full-screen working perfectly. It changes display modes, and shows the graphics without problem. However, whenever I change display modes within the game, the cursor coordinates are completely messed up. It seems like the scale is correct (except a little off when going between widescreen and standard ratios), it's just offset by a certain number of pixels depending on the new mode. Is there any way of resetting the rectangle used for cursor events? (without using a window, of course)
I achieve fullscreen by using CGDisplayCapture and CGDisplayBestModeForParameters/CGDisplaySwitchToMode. When I change resolutions, I use CGDisplayBestModeForParameters/CGDisplaySwitchToMode, but I also tried releasing and re-capturing the display, and also changing back to the original desktop resolution before releasing the display to no avail. Any help would be appreciated.
Edit: to clarify, the first resolution change when launching the game doesn't effect the cursor coordinates, it's only when changing the resolution from my options menu after launching the game.
Cursor coordinates off during resolution change - kelvin - Aug 19, 2005 02:25 PM
in Cocoa, the NSScreen frame height won't change when you get the new screen rez. The solution is to offset by the difference of the old screen and the new screen height + 1.
Cursor coordinates off during resolution change - akb825 - Aug 19, 2005 08:21 PM
unknown: I see you thought twice about your suggestion
Edit: works perfectly. Thanks again.