diff options
| author | Starla Insigna <starla4444@gmail.com> | 2011-07-30 11:19:14 -0400 |
|---|---|---|
| committer | Starla Insigna <starla4444@gmail.com> | 2011-07-30 11:19:14 -0400 |
| commit | 9cd57b731ab1c666d4a1cb725538fdc137763d12 (patch) | |
| tree | 5bac45ae5157a1cb10c6e45500cbf72789917980 /libs/cocos2d/Platforms/Mac/CCDirectorMac.h | |
| download | cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2 cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip | |
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/Platforms/Mac/CCDirectorMac.h')
| -rwxr-xr-x | libs/cocos2d/Platforms/Mac/CCDirectorMac.h | 103 |
1 files changed, 103 insertions, 0 deletions
| diff --git a/libs/cocos2d/Platforms/Mac/CCDirectorMac.h b/libs/cocos2d/Platforms/Mac/CCDirectorMac.h new file mode 100755 index 0000000..0d623b4 --- /dev/null +++ b/libs/cocos2d/Platforms/Mac/CCDirectorMac.h | |||
| @@ -0,0 +1,103 @@ | |||
| 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 | |||
| 27 | // Only compile this code on Mac. These files should not be included on your iOS project. | ||
| 28 | // But in case they are included, it won't be compiled. | ||
| 29 | #import <Availability.h> | ||
| 30 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED | ||
| 31 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) | ||
| 32 | |||
| 33 | #import <QuartzCore/CVDisplayLink.h> | ||
| 34 | #import "../../CCDirector.h" | ||
| 35 | |||
| 36 | enum { | ||
| 37 | /// If the window is resized, it won't be autoscaled | ||
| 38 | kCCDirectorResize_NoScale, | ||
| 39 | /// If the window is resized, it will be autoscaled (default behavior) | ||
| 40 | kCCDirectorResize_AutoScale, | ||
| 41 | }; | ||
| 42 | |||
| 43 | @interface CCDirector (MacExtension) | ||
| 44 | /** converts an NSEvent to GL coordinates */ | ||
| 45 | -(CGPoint) convertEventToGL:(NSEvent*)event; | ||
| 46 | @end | ||
| 47 | |||
| 48 | /** Base class of Mac directors | ||
| 49 | @since v0.99.5 | ||
| 50 | */ | ||
| 51 | @interface CCDirectorMac : CCDirector | ||
| 52 | { | ||
| 53 | BOOL isFullScreen_; | ||
| 54 | int resizeMode_; | ||
| 55 | CGPoint winOffset_; | ||
| 56 | CGSize originalWinSize_; | ||
| 57 | |||
| 58 | NSWindow *fullScreenWindow_; | ||
| 59 | |||
| 60 | // cache | ||
| 61 | NSWindow *windowGLView_; | ||
| 62 | NSView *superViewGLView_; | ||
| 63 | NSRect originalWinRect_; // Original size and position | ||
| 64 | } | ||
| 65 | |||
| 66 | // whether or not the view is in fullscreen mode | ||
| 67 | @property (nonatomic, readonly) BOOL isFullScreen; | ||
| 68 | |||
| 69 | // resize mode: with or without scaling | ||
| 70 | @property (nonatomic, readwrite) int resizeMode; | ||
| 71 | |||
| 72 | @property (nonatomic, readwrite) CGSize originalWinSize; | ||
| 73 | |||
| 74 | /** Sets the view in fullscreen or window mode */ | ||
| 75 | - (void) setFullScreen:(BOOL)fullscreen; | ||
| 76 | |||
| 77 | /** Converts window size coordiantes to logical coordinates. | ||
| 78 | Useful only if resizeMode is kCCDirectorResize_Scale. | ||
| 79 | If resizeMode is kCCDirectorResize_NoScale, then no conversion will be done. | ||
| 80 | */ | ||
| 81 | - (CGPoint) convertToLogicalCoordinates:(CGPoint)coordinates; | ||
| 82 | @end | ||
| 83 | |||
| 84 | |||
| 85 | /** DisplayLinkDirector is a Director that synchronizes timers with the refresh rate of the display. | ||
| 86 | * | ||
| 87 | * Features and Limitations: | ||
| 88 | * - Only available on 3.1+ | ||
| 89 | * - Scheduled timers & drawing are synchronizes with the refresh rate of the display | ||
| 90 | * - Only supports animation intervals of 1/60 1/30 & 1/15 | ||
| 91 | * | ||
| 92 | * It is the recommended Director if the SDK is 3.1 or newer | ||
| 93 | * | ||
| 94 | * @since v0.8.2 | ||
| 95 | */ | ||
| 96 | @interface CCDirectorDisplayLink : CCDirectorMac | ||
| 97 | { | ||
| 98 | CVDisplayLinkRef displayLink; | ||
| 99 | } | ||
| 100 | @end | ||
| 101 | |||
| 102 | #endif // __MAC_OS_X_VERSION_MAX_ALLOWED | ||
| 103 | |||
