(Solved, sort of) Converting mouse coordinates in fullscreen context?
(Solved, sort of) Converting mouse coordinates in fullscreen context?
- Subject: (Solved, sort of) Converting mouse coordinates in fullscreen context?
- From: arekkusu <email@hidden>
- Date: Wed, 26 Feb 2003 03:54:56 -0800
Thanks to those who replied.
The iDevGames thread:
http://www.idevgames.com/forum/showthread.php?s=&threadid=1461
mentions that this is a known bug between CG and NSScreen.
So, I had to split my mouse code into two paths, but now it works fine
via:
- (void) mouseDown:(NSEvent*)event {
NSPoint loc;
if (!fullscreen) {
loc = [self convertPoint:[event locationInWindow] fromView:nil];
}
else {
loc = [NSEvent mouseLocation]; // global screen coords
loc.y -= (screendim.size.height); // screendim set to [[win
screen] frame] when entering fullscreen
loc.y *= -1; // flipped coord system
}
....
}
On Monday, February 24, 2003, at 09:59 PM, arekkusu wrote:
>
Here's my problem: in windowed mode I am getting sensible mouse
>
coordinates via:
>
>
- (void) mouseDown:(NSEvent*)event{
>
NSPoint loc = [viewport convertPoint:[event locationInWindow]
>
fromView:nil];
>
NSLog(@"mouse down (%@): (%f, %f)", event, loc.x, loc.y);
>
}
>
>
e.g. from (0,0) to (639,399) in a 640x400 window (although the resize
>
widget obscures one corner, as expected.)
>
>
But, in a fullscreen context, 896x600 for example, the same function
>
reports mouse coordinates from (0, -454) to (895, 145).
>
The vertical coordinates change depending on how big the (windowed
>
mode) window is, but they always include some negative values.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.