| 1 | |
| 2 | @implementation MyView2 |
| 3 | |
| 4 | int __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 | |