-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbasic.c
36 lines (24 loc) · 909 Bytes
/
basic.c
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
#define GL_SILENCE_DEPRECATION
#define SILICON_IMPLEMENTATION
#include "silicon.h"
NSApplication* NSApp;
NSWindow* win;
bool windowShouldClose(void* self) {
NSRelease(NSApp);
NSRelease(win);
NSApplication_stop(NSApp, self);
return true;
}
int main() {
NSApp = NSApplication_sharedApplication();
NSApplication_setActivationPolicy(NSApp, NSApplicationActivationPolicyRegular);
si_func_to_SEL(SI_DEFAULT, windowShouldClose);
win = NSWindow_init(NSMakeRect(500, 500, 200, 200),
NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable, NSBackingStoreBuffered,
false
);
NSWindow_setTitle(win, "Basic Example");
NSWindow_makeKeyAndOrderFront(win, nil);
NSApplication_run(NSApp);
return 0;
}