You need to log in to create posts and topics.
Feelin' Old
1,678 Posts
#1 · September 11, 2011, 1:26 pm
Quote from Forum Archives on September 11, 2011, 1:26 pmPosted by: svanvoorst <svanvoorst@...>
Ken,You want to see a geezer, check this out ( a little help from David Chisnall) .'----- begin -----
compile as "Objective-C"if system(_sysVers) < 1060 then stop "Requires OS 10.6 or newer"include library "QuartzCore"include library "QTKit"BeginCDeclaration@interface AppDelegate : NSObject@end //interfaceEndCBeginCFunction@implementation AppDelegate-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) theApp;{return YES;}@end //implementationEndCBeginCCode{NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];[NSApplication sharedApplication];[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];// ---- Create an instance of AppDelegate (NSObject) ---- //id myDelegate = [[AppDelegate alloc]init];[NSApp setDelegate:myDelegate];// ******** Menu and menubar ********//id menubar = [[NSMenu new] autorelease];id appMenuItem = [[NSMenuItem new] autorelease];[menubar addItem:appMenuItem];[NSApp setMainMenu:menubar];id appMenu = [[NSMenu new] autorelease];id quitMenuItem = [[[NSMenuItem alloc] initWithTitle:@"Quit"action:@selector(terminate:) keyEquivalent:@"q"] autorelease];[appMenu addItem:quitMenuItem];[appMenuItem setSubmenu:appMenu];// ******** Window ******** //#define _wndW 350#define _wndH 280id window = [[NSWindow alloc] initWithContentRect:NSMakeRect( 0, 0, _wndW, _wndH )styleMask:NSTitledWindowMask | NSClosableWindowMaskbacking:NSBackingStoreBuffereddefer:NO];[window center];[window setTitle:@"Geezer"];id imgView = [[QTCaptureView alloc]initWithFrame:NSMakeRect( 0, 0, _wndW,_wndH )];[[window contentView] addSubview:imgView];id session = [QTCaptureSession new];QTCaptureDevice *camera =[QTCaptureDevice defaultInputDeviceWithMediaType: QTMediaTypeVideo];[camera open:NULL];QTCaptureInput *input =[[QTCaptureDeviceInput alloc]initWithDevice:camera];[session addInput:input error:NULL];[input release];id file = [QTCaptureMovieFileOutput new];[session addOutput:file error:NULL];[imgView setCaptureSession:session];[session startRunning];[window makeKeyAndOrderFront:nil];[NSApp activateIgnoringOtherApps:YES];[NSApp run];[imgView release];[pool drain];}EndC
'----- end -------Feelin' pretty young myself 😉Steve Van Voorst
To unsubscribe, e-mail: fbcocoa-unsubscribe@welovegod.org
For additional commands, e-mail: fbcocoa-help@freegroups.net
Posted by: svanvoorst <svanvoorst@...>
Ken,
You want to see a geezer, check this out ( a little help from David Chisnall) .
'----- begin -----
compile as "Objective-C"
if system(_sysVers) < 1060 then stop "Requires OS 10.6 or newer"
include library "QuartzCore"
include library "QTKit"
BeginCDeclaration
@interface AppDelegate : NSObject
@end //interface
EndC
BeginCFunction
@implementation AppDelegate
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) theApp;
{
return YES;
}
@end //implementation
EndC
BeginCCode
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
// ---- Create an instance of AppDelegate (NSObject) ---- //
id myDelegate = [[AppDelegate alloc]init];
[NSApp setDelegate:myDelegate];
// ******** Menu and menubar ********//
id menubar = [[NSMenu new] autorelease];
id appMenuItem = [[NSMenuItem new] autorelease];
[menubar addItem:appMenuItem];
[NSApp setMainMenu:menubar];
id appMenu = [[NSMenu new] autorelease];
id quitMenuItem = [[[NSMenuItem alloc] initWithTitle:@"Quit"
action:@selector(terminate:) keyEquivalent:@"q"] autorelease];
[appMenu addItem:quitMenuItem];
[appMenuItem setSubmenu:appMenu];
// ******** Window ******** //
#define _wndW 350
#define _wndH 280
id window = [[NSWindow alloc] initWithContentRect:NSMakeRect( 0, 0, _wndW, _wndH )
styleMask:NSTitledWindowMask | NSClosableWindowMask
backing:NSBackingStoreBuffered
defer:NO];
[window center];
[window setTitle:@"Geezer"];
id imgView = [[QTCaptureView alloc]initWithFrame:NSMakeRect( 0, 0, _wndW,_wndH )];
[[window contentView] addSubview:imgView];
id session = [QTCaptureSession new];
QTCaptureDevice *camera =
[QTCaptureDevice defaultInputDeviceWithMediaType: QTMediaTypeVideo];
[camera open:NULL];
QTCaptureInput *input =
[[QTCaptureDeviceInput alloc]initWithDevice:camera];
[session addInput:input error:NULL];
[input release];
id file = [QTCaptureMovieFileOutput new];
[session addOutput:file error:NULL];
[imgView setCaptureSession:session];
[session startRunning];
[window makeKeyAndOrderFront:nil];
[NSApp activateIgnoringOtherApps:YES];
[NSApp run];
[imgView release];
[pool drain];
}
EndC
'----- end -------
Feelin' pretty young myself 😉
Steve Van Voorst
To unsubscribe, e-mail: fbcocoa-unsubscribe@welovegod.org
For additional commands, e-mail: fbcocoa-help@freegroups.net
Click for thumbs down.0Click for thumbs up.0