diff options
Diffstat (limited to 'libs/cocos2d/Platforms/Mac/MacGLView.h')
-rwxr-xr-x | libs/cocos2d/Platforms/Mac/MacGLView.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/libs/cocos2d/Platforms/Mac/MacGLView.h b/libs/cocos2d/Platforms/Mac/MacGLView.h new file mode 100755 index 0000000..8099273 --- /dev/null +++ b/libs/cocos2d/Platforms/Mac/MacGLView.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org | ||
3 | * | ||
4 | * Copyright (c) 2010 Ricardo Quesada | ||
5 | * Copyright (c) 2011 Zynga Inc. | ||
6 | * | ||
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
8 | * of this software and associated documentation files (the "Software"), to deal | ||
9 | * in the Software without restriction, including without limitation the rights | ||
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
11 | * copies of the Software, and to permit persons to whom the Software is | ||
12 | * furnished to do so, subject to the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice shall be included in | ||
15 | * all copies or substantial portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
23 | * THE SOFTWARE. | ||
24 | */ | ||
25 | |||
26 | // Only compile this code on Mac. These files should not be included on your iOS project. | ||
27 | // But in case they are included, it won't be compiled. | ||
28 | #import <Availability.h> | ||
29 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED | ||
30 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) | ||
31 | |||
32 | #import <Cocoa/Cocoa.h> | ||
33 | |||
34 | #import "../../ccConfig.h" | ||
35 | |||
36 | //PROTOCOLS: | ||
37 | |||
38 | @protocol MacEventDelegate <NSObject> | ||
39 | // Mouse | ||
40 | - (void)mouseDown:(NSEvent *)theEvent; | ||
41 | - (void)mouseUp:(NSEvent *)theEvent; | ||
42 | - (void)mouseMoved:(NSEvent *)theEvent; | ||
43 | - (void)mouseDragged:(NSEvent *)theEvent; | ||
44 | - (void)rightMouseDown:(NSEvent*)event; | ||
45 | - (void)rightMouseDragged:(NSEvent*)event; | ||
46 | - (void)rightMouseUp:(NSEvent*)event; | ||
47 | - (void)otherMouseDown:(NSEvent*)event; | ||
48 | - (void)otherMouseDragged:(NSEvent*)event; | ||
49 | - (void)otherMouseUp:(NSEvent*)event; | ||
50 | - (void)scrollWheel:(NSEvent *)theEvent; | ||
51 | - (void)mouseEntered:(NSEvent *)theEvent; | ||
52 | - (void)mouseExited:(NSEvent *)theEvent; | ||
53 | |||
54 | |||
55 | // Keyboard | ||
56 | - (void)keyDown:(NSEvent *)theEvent; | ||
57 | - (void)keyUp:(NSEvent *)theEvent; | ||
58 | - (void)flagsChanged:(NSEvent *)theEvent; | ||
59 | |||
60 | // Touches | ||
61 | - (void)touchesBeganWithEvent:(NSEvent *)event; | ||
62 | - (void)touchesMovedWithEvent:(NSEvent *)event; | ||
63 | - (void)touchesEndedWithEvent:(NSEvent *)event; | ||
64 | - (void)touchesCancelledWithEvent:(NSEvent *)event; | ||
65 | |||
66 | #if CC_DIRECTOR_MAC_USE_DISPLAY_LINK_THREAD | ||
67 | - (void)queueEvent:(NSEvent*)event selector:(SEL)selector; | ||
68 | #endif | ||
69 | |||
70 | @end | ||
71 | |||
72 | /** MacGLView | ||
73 | |||
74 | Only available for Mac OS X | ||
75 | */ | ||
76 | @interface MacGLView : NSOpenGLView { | ||
77 | id<MacEventDelegate> eventDelegate_; | ||
78 | } | ||
79 | |||
80 | @property (nonatomic, readwrite, assign) id<MacEventDelegate> eventDelegate; | ||
81 | |||
82 | // initializes the MacGLView with a frame rect and an OpenGL context | ||
83 | - (id) initWithFrame:(NSRect)frameRect shareContext:(NSOpenGLContext*)context; | ||
84 | |||
85 | // private | ||
86 | +(void) load_; | ||
87 | @end | ||
88 | |||
89 | #endif // __MAC_OS_X_VERSION_MAX_ALLOWED \ No newline at end of file | ||