home *** CD-ROM | disk | FTP | other *** search
-
- #import "ScreenSaver.h"
-
- @implementation ScreenSaver
-
- void runOneStep (DPSTimedEntry timedEntry, double timeNow, void *data);
-
- - startScreenSaver
- {
- void runOneStep();
-
- if( !timerRunning )
- {
- PShidecursor();
- bouncingView = [[[[NXBundle bundleForClass: [self class]]
- classNamed: "BouncingView"] alloc] init];
- [bouncingView startScreenSaver];
- timer = DPSAddTimedEntry(1.0 / 15.0, &runOneStep,
- bouncingView, NX_BASETHRESHOLD);
- timerRunning = YES;
- }
-
- return self;
- }
-
- - stopScreenSaver
- {
- if( timerRunning )
- {
- PSshowcursor();
- DPSRemoveTimedEntry (timer);
- timerRunning = NO;
- [bouncingView stopScreenSaver];
- [bouncingView free];
- }
-
- return self;
- }
-
- void runOneStep (DPSTimedEntry timedEntry, double timeNow, void *data)
- {
- [(id)data step];
- }
-
-
- @end
-