v / thirdparty / sokol / sokol_app2.h
40 lines · 28 sloc · 613 bytes · c7a6d28e13e6a72ed1fe4b78d1f5c26f7d99990e
Raw
1
2@implementation MyView2
3
4int __v_sokol_inited = 0;
5
6// Alternative drawRect which calls a frame function with native Cocoa calls
7- (void)drawRect:(NSRect)rect {
8 //puts("drawRect()");
9 if (__v_sokol_inited == 0) {
10 _sapp_call_init();
11 __v_sokol_inited = 1;
12 }
13 _sapp_call_frame_native();
14}
15
16//- (BOOL)isOpaque {
17// return NO;
18//}
19
20- (BOOL)canBecomeKeyView {
21 return YES;
22}
23- (BOOL)acceptsFirstResponder {
24 return YES;
25}
26
27// - (void)mouseExited:(NSEvent*)event {
28// }
29
30// - (void)mouseDown:(NSEvent*)event {
31// }
32
33- (BOOL)acceptsFirstMouse:(NSEvent *)event {
34 return YES;
35}
36
37
38@end
39
40
41