Re: NSScreenSaverView and keystrokes
Re: NSScreenSaverView and keystrokes
- Subject: Re: NSScreenSaverView and keystrokes
- From: Eric Peyton <email@hidden>
- Date: Thu, 28 Jun 2001 11:37:54 -0500
On Thursday, June 28, 2001, at 09:39 AM, Eric Hon-Anderson wrote:
The After Dark screen saver on the old Mac OS supplied an API for
screen saver modules to intercept events for their own use,
without signalling the screen saver to quit. This was used to make
a small number of keyboard-only games, and to control aspects of
some screen saver modules as they ran. I wasn't able to find an
equivalent API in NSScreenSaverView and its relatives. Did I miss
something that would be obvious to someone with more Cocoa
experience? Thanks.
Ahh - it's easier than you think. You can just override -mouse and
-key events on your NSScreenSaverView subclass and use those events
instead of having the screensaver view unsave the screen.
For an example, look at the code for SpiroScales in the epicware
screensavers pack.
bbum wrote the code and will probably chime in here as well.
// override these so mouse movement won't unsave screen
- (void)mouseEntered:(NSEvent *)theEvent;
{
}
- (void)mouseExited:(NSEvent *)theEvent;
{
}
Then in your animateOneFrame method you can do something like this
NSPoint mp = [[self window] mouseLocationOutsideOfEventStream];
and then use that location.
You can also override the clicks and keyboard events.
Very very cool.
Eric
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev