Cursor coordinates off during resolution change

Moderator
Posts: 1,140
Joined: 2005.07
Post: #1
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.
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #2
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

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #3
w00t thanks.

unknown: I see you thought twice about your suggestion Wink

Edit: works perfectly. Thanks again.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Local (X, Y) Coordinates from 3D plane coordinates merrill541 5 6,906 Jun 29, 2009 01:32 AM
Last Post: RhinosoRoss
  Changing cursor in C++/SDL possible? Bonked 1 3,175 Dec 16, 2006 06:40 AM
Last Post: sealfin
  Translate mouse coordinates to world coordinates nalenb 4 6,412 Mar 21, 2006 11:59 PM
Last Post: glMatt
  Hiding the Cursor in Carbon? DoG 1 2,492 Feb 17, 2006 02:33 AM
Last Post: DoG
  How to change zNear and zFar dynamically Brecht 1 2,227 Dec 29, 2005 05:44 PM
Last Post: OneSadCookie