I'm trying to manage mouse events in my prototype of Sprite-kit game.
I used the following methods from the question SO_q
- (void) mouseDown: (NSEvent*) theEvent
{
NSLog(@"Click!");
}
- (void) rightMouseDown:(NSEvent*) theEvent
{
NSLog(@"DERECHA PULSADA!");
}
But the method to detect the right clic doesn't work for me. I want to detect click and drop of right mouse click. How can i detect when the mouse click is dropped ?
UPDATE:
I tried with the following mehod, picked up from the Cocoa Event Handling Doc.
- (void)mouseDown:(NSEvent *)theEvent
{
switch ([theEvent type])
{
case NSLeftMouseDown:
NSLog(@"ISQUIERDO down!");
break;
case NSLeftMouseUp:
NSLog(@"IZQDO soltado!");
break;
case RightMouseDown:
NSLog(@"DERECHO PUSSSHHH!");
break;
case NSRightMouseUp:
NSLog(@"Botón Derecho Soltado!");
break;
default:
/* Ignore any other kind of event. */
break;
}
return;
}
Result: Only event for the left click has been handled.
Following reading the Cocoa Event Handling Doc i tried overwriting the following methods:
-(void)rightMouseDown:(NSEvent *)theEvent
{
NSLog(@"DERECHO PUSSSHHH!");
}
- (void)rightMouseUp:(NSEvent *)theEvent
{
NSLog(@"Botón Derecho Soltado!");
}
Didn't work too.
UPDATE:
Like i said before, theses methods are in a Sprite-Kit class. Here the class definition where these methods are defined.
#import <SpriteKit/SpriteKit.h>
@interface OpcionesMenu : SKScene
@end