-
Notifications
You must be signed in to change notification settings - Fork 3
/
BabyController.m
44 lines (35 loc) · 1.43 KB
/
BabyController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// BabyController.m
// BabyFingers
//
// Created by Baris Metin
//
#import "BabyController.h"
#import "BabyWindow.h"
#import "BabyScreen.h"
@implementation BabyController
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
NSRect mainDisplayRect = [[NSScreen mainScreen] frame];
BabyWindow *mainWindow = [[BabyWindow alloc] initWithContentRect: mainDisplayRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES];
[mainWindow setLevel:NSMainMenuWindowLevel+1];
[mainWindow setOpaque:YES];
[mainWindow setHidesOnDeactivate:YES];
[mainWindow setAcceptsMouseMovedEvents:YES];
[mainWindow makeKeyWindow];
NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFADoubleBuffer,
0
};
NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
NSRect viewRect = NSMakeRect(0.0, 0.0, mainDisplayRect.size.width, mainDisplayRect.size.height);
babyScreen = [[BabyScreen alloc] initWithFrame:viewRect pixelFormat: pixelFormat];
[mainWindow setContentView:babyScreen];
[mainWindow setInitialFirstResponder:babyScreen];
[mainWindow makeFirstResponder:babyScreen];
[mainWindow makeKeyAndOrderFront:self];
}
@end