Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-mouseMoved OSX does not get called in a sprite kit SKScene

The following responder (defined in NSResponder) does not get called in an SKScene in OSX:

-(void) mouseMoved:(NSEvent *)theEvent {
    DLog(@"TEST");
}

I have said the window to accept mouse moved events in the app delegate.

_window.acceptsMouseMovedEvents = YES;

Thank you in advance.

SOLUTION:

Add to the app delegate:

_window.acceptsMouseMovedEvents = YES;
[_window makeFirstResponder:self.skView.scene];
like image 456
Theis Egeberg Avatar asked Jan 12 '23 00:01

Theis Egeberg


2 Answers

Add to the app delegate:

_window.acceptsMouseMovedEvents = YES;
[_window makeFirstResponder:self.skView.scene];
like image 194
Theis Egeberg Avatar answered Mar 06 '23 23:03

Theis Egeberg


In swift

window.acceptsMouseMovedEvents = true;
window.makeFirstResponder(self.skView.scene)
like image 23
CodyMace Avatar answered Mar 06 '23 23:03

CodyMace