blob: 9e0e0e35c5a1e82bdd2459ad04cd76f28b7e66f7 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
//
// LLAppDelegate.m
// SecondLife
//
// Created by Geenz on 12/16/12.
//
//
#import "llappdelegate-objc.h"
@implementation LLAppDelegate
@synthesize window;
- (void)dealloc
{
[super dealloc];
}
- (void) applicationDidFinishLaunching:(NSNotification *)notification
{
frameTimer = nil;
if (initViewer())
{
frameTimer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(mainLoop) userInfo:nil repeats:YES];
} else {
handleQuit();
}
}
- (void) applicationDidBecomeActive:(NSNotification *)notification
{
callWindowFocus();
}
- (void) applicationDidResignActive:(NSNotification *)notification
{
callWindowUnfocus();
}
- (NSApplicationDelegateReply) applicationShouldTerminate:(NSApplication *)sender
{
if (!runMainLoop())
{
handleQuit();
return NSTerminateCancel;
} else {
[frameTimer release];
cleanupViewer();
return NSTerminateNow;
}
}
- (void) mainLoop
{
bool appExiting = runMainLoop();
if (appExiting)
{
[frameTimer release];
[[NSApplication sharedApplication] terminate:self];
}
}
@end
|