PDA

View Full Version : Cursor coordinates off during resolution change


akb825
2005.08.19, 02:53 PM
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.

kelvin
2005.08.19, 06: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.

NSScreen docs (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSScreen.html#//apple_ref/doc/uid/20000333-CJBBEFJG)

akb825
2005.08.20, 12:21 AM
w00t thanks.

unknown: I see you thought twice about your suggestion ;)

Edit: works perfectly. Thanks again.