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