-
Notifications
You must be signed in to change notification settings - Fork 0
/
CNC_Main.mm
63 lines (48 loc) · 1.67 KB
/
CNC_Main.mm
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
#include <AppKit/AppKit.h>
#include "CNC_Window.mm"
#include "CNC_Platform.mm"
#include "CNC_Renderer.mm"
#include "CNC_Application.h"
#include "CNC_Application.cpp"
int main(void)
{
NSApplication* app = [NSApplication sharedApplication];
[app setActivationPolicy: NSApplicationActivationPolicyRegular];
[app setPresentationOptions: NSApplicationPresentationDefault];
[app activateIgnoringOtherApps:true];
[app finishLaunching];
bool running = true;
bool start = false;
struct Application ClockApp = {0};
struct Platform MacosPlatform = {0};
MainWindow* window = CreateMainWindow( &running, &ClockApp.m_start );
Renderer* renderer = CreateRenderer( SCREEN_WIDTH, SCREEN_HEIGHT );
window.contentView = renderer->m_view;
InitPlatform( &MacosPlatform, renderer );
ClockApp.m_platform = MacosPlatform;
Load( &ClockApp );
@autoreleasepool
{
NSEvent* event = NULL;
while( running )
{
do
{
event = [app nextEventMatchingMask:NSEventMaskAny
untilDate:NULL
inMode:NSDefaultRunLoopMode
dequeue:true];
[app sendEvent: event];
[app updateWindows];
}
while( event != NULL );
[window->m_displayLinkSignal wait];
// run your code here
Update( &ClockApp );
Render( &ClockApp );
[renderer Render];
}
}
Exit( &ClockApp );
return 0;
}