mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
fix event mouse move
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1741 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
bb7a6fac1f
commit
fd02b2d3af
@ -192,6 +192,40 @@
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)scrollWheel:(NSEvent*)theEvent
|
||||
{
|
||||
if (myRequester == 0) return;
|
||||
|
||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
// Don't forget to change to SFML coord system.
|
||||
float h = [[theEvent window] frame].size.height;
|
||||
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, h - loc.y);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)mouseEntered:(NSEvent*)theEvent
|
||||
{
|
||||
myMouseIsIn = YES;
|
||||
|
||||
if (myRequester == 0) return;
|
||||
|
||||
myRequester->MouseMovedIn();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)mouseExited:(NSEvent*)theEvent
|
||||
{
|
||||
myMouseIsIn = NO;
|
||||
|
||||
if (myRequester == 0) return;
|
||||
|
||||
myRequester->MouseMovedOut();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)rightMouseDown:(NSEvent*)theEvent
|
||||
{
|
||||
@ -269,36 +303,47 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)scrollWheel:(NSEvent*)theEvent
|
||||
-(void)rightMouseDragged:(NSEvent*)theEvent
|
||||
{
|
||||
if (myRequester == 0) return;
|
||||
|
||||
// If the event is not useful.
|
||||
if (!myMouseIsIn) return;
|
||||
|
||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
// Don't forget to change to SFML coord system.
|
||||
float h = [[theEvent window] frame].size.height;
|
||||
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, h - loc.y);
|
||||
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)mouseEntered:(NSEvent*)theEvent
|
||||
-(void)mouseDragged:(NSEvent*)theEvent
|
||||
{
|
||||
myMouseIsIn = YES;
|
||||
|
||||
if (myRequester == 0) return;
|
||||
|
||||
myRequester->MouseMovedIn();
|
||||
// If the event is not useful.
|
||||
if (!myMouseIsIn) return;
|
||||
|
||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
// Don't forget to change to SFML coord system.
|
||||
float h = [[theEvent window] frame].size.height;
|
||||
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)mouseExited:(NSEvent*)theEvent
|
||||
-(void)otherMouseDragged:(NSEvent*)theEvent
|
||||
{
|
||||
myMouseIsIn = NO;
|
||||
|
||||
if (myRequester == 0) return;
|
||||
|
||||
myRequester->MouseMovedOut();
|
||||
// If the event is not useful.
|
||||
if (!myMouseIsIn) return;
|
||||
|
||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
// Don't forget to change to SFML coord system.
|
||||
float h = [[theEvent window] frame].size.height;
|
||||
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user