Re: Better random screensaver
Re: Better random screensaver
- Subject: Re: Better random screensaver
- From: Webb <email@hidden>
- Date: Tue, 5 Nov 2002 20:58:27 +0800
I made one named RandomExtra in August.
Download:
http://webbingtec.fateback.com/download/randomextra10.dmg.sit
And source code:
http://webbingtec.fateback.com/download/randomextra10_src.dmg.sit
It will be popular? I am putting it on versiontracker now, to see YES or
No...:-)
Code picked from RandomExtraView.m
================================================================
- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
NSBundle* thisBundle = [NSBundle bundleForClass:[self class]];
NSString* aString = nil;
self = [super initWithFrame:frame isPreview:isPreview];
if (self) {
if (isPreview) {
aString = [thisBundle
localizedStringForKey:@"defaultContent" value:@"RandomExtra" table:nil];
[self renderTextWithString:aString];
}
else {
ScreenSaverModules* modules = [ScreenSaverModules
sharedInstance];
NSString* moduleName = pickModule();
if (moduleName) {
id aModule = [modules loadModuleWithName:moduleName
frame:frame isPreview:isPreview];
// Screen savers are subclasses of ScreenSaverView,
// packaged up in bundles and loaded by the screen saver
application
// So just return an instance of another module here and
the caller cannot know who I am
// This is just the key how we can do the "switch"
if ( aModule && [aModule isKindOfClass:[ScreenSaverView
class]] ) {
[super dealloc];
self = [aModule retain];
} else {
aString = [thisBundle
localizedStringForKey:@"activeFail"
value:@"Cannot active
module \"%@\"!" table:nil];
[self renderTextWithString:[NSString
stringWithFormat:aString,moduleName]];
}
} else {
aString = [thisBundle localizedStringForKey:@"pickFail"
value:@"I cannot pick
a module for you!" table:nil];
[self renderTextWithString:aString];
}
}
}
return self;
}
Regards
Webb -
http://www.webbingtec.com
On Wednesday, October 30, 2002, at 11:08 PM, Salter, Adam Q wrote:
> So... I have decided to try and make a screen saver randomiser to
> replace
> the current one...
>
> I understand how to make a "randomise" list by seaching all the likely
> places you would find a screensaver, but I can't see how to send the
> output
> of my randomly chosen external "screen saver".saver into the NSView of
> my
> screensaver.
>
> Can anybody provide any pointers?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.