diff --git a/cocos2dx/platform/ios/CCAccelerometer.mm b/cocos2dx/platform/ios/CCAccelerometer.mm index d97d0284e8..d11e728f0a 100644 --- a/cocos2dx/platform/ios/CCAccelerometer.mm +++ b/cocos2dx/platform/ios/CCAccelerometer.mm @@ -29,7 +29,7 @@ #import #import -@interface AccelerometerDispatcher : NSObject +@interface CCAccelerometerDispatcher : NSObject { std::function _function; cocos2d::Acceleration *_acceleration; @@ -42,9 +42,9 @@ @end -@implementation AccelerometerDispatcher +@implementation CCAccelerometerDispatcher -static AccelerometerDispatcher* s_pAccelerometerDispatcher; +static CCAccelerometerDispatcher* s_pAccelerometerDispatcher; + (id) sharedAccelerometerDispather { @@ -140,12 +140,12 @@ Accelerometer::~Accelerometer() {} void Accelerometer::setDelegate(std::function function) { - [[AccelerometerDispatcher sharedAccelerometerDispather] addDelegate:function]; + [[CCAccelerometerDispatcher sharedAccelerometerDispather] addDelegate:function]; } void Accelerometer::setAccelerometerInterval(float interval) { - [[AccelerometerDispatcher sharedAccelerometerDispather] setAccelerometerInterval:interval]; + [[CCAccelerometerDispatcher sharedAccelerometerDispather] setAccelerometerInterval:interval]; } NS_CC_END diff --git a/cocos2dx/platform/ios/CCApplication.mm b/cocos2dx/platform/ios/CCApplication.mm index ce54a030d1..a096350d11 100644 --- a/cocos2dx/platform/ios/CCApplication.mm +++ b/cocos2dx/platform/ios/CCApplication.mm @@ -49,14 +49,14 @@ int Application::run() { if (applicationDidFinishLaunching()) { - [[DirectorCaller sharedDirectorCaller] startMainLoop]; + [[CCDirectorCaller sharedDirectorCaller] startMainLoop]; } return 0; } void Application::setAnimationInterval(double interval) { - [[DirectorCaller sharedDirectorCaller] setAnimationInterval: interval ]; + [[CCDirectorCaller sharedDirectorCaller] setAnimationInterval: interval ]; } ///////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/cocos2dx/platform/ios/CCDirectorCaller.h b/cocos2dx/platform/ios/CCDirectorCaller.h index e5e9a039ba..f9a6ca330d 100644 --- a/cocos2dx/platform/ios/CCDirectorCaller.h +++ b/cocos2dx/platform/ios/CCDirectorCaller.h @@ -23,7 +23,7 @@ ****************************************************************************/ #import -@interface DirectorCaller : NSObject { +@interface CCDirectorCaller : NSObject { id displayLink; int interval; } diff --git a/cocos2dx/platform/ios/CCDirectorCaller.mm b/cocos2dx/platform/ios/CCDirectorCaller.mm index 814d2b701c..fdef9571b7 100644 --- a/cocos2dx/platform/ios/CCDirectorCaller.mm +++ b/cocos2dx/platform/ios/CCDirectorCaller.mm @@ -34,7 +34,7 @@ static id s_sharedDirectorCaller; -(void) invalidate; @end -@implementation DirectorCaller +@implementation CCDirectorCaller @synthesize interval; @@ -42,7 +42,7 @@ static id s_sharedDirectorCaller; { if (s_sharedDirectorCaller == nil) { - s_sharedDirectorCaller = [DirectorCaller new]; + s_sharedDirectorCaller = [CCDirectorCaller new]; } return s_sharedDirectorCaller; diff --git a/cocos2dx/platform/ios/CCEGLView.mm b/cocos2dx/platform/ios/CCEGLView.mm index f632e7e5d4..7902a2dec6 100644 --- a/cocos2dx/platform/ios/CCEGLView.mm +++ b/cocos2dx/platform/ios/CCEGLView.mm @@ -32,8 +32,8 @@ NS_CC_BEGIN EGLView::EGLView() { - _screenSize.width = _designResolutionSize.width = [[EAGLView sharedEGLView] getWidth]; - _screenSize.height = _designResolutionSize.height = [[EAGLView sharedEGLView] getHeight]; + _screenSize.width = _designResolutionSize.width = [[CCEAGLView sharedEGLView] getWidth]; + _screenSize.height = _designResolutionSize.height = [[CCEAGLView sharedEGLView] getHeight]; } EGLView::~EGLView() @@ -43,7 +43,7 @@ EGLView::~EGLView() bool EGLView::isOpenGLReady() { - return [EAGLView sharedEGLView] != NULL; + return [CCEAGLView sharedEGLView] != NULL; } bool EGLView::setContentScaleFactor(float contentScaleFactor) @@ -51,34 +51,34 @@ bool EGLView::setContentScaleFactor(float contentScaleFactor) assert(_resolutionPolicy == kResolutionUnKnown); // cannot enable retina mode _scaleX = _scaleY = contentScaleFactor; - [[EAGLView sharedEGLView] setNeedsLayout]; + [[CCEAGLView sharedEGLView] setNeedsLayout]; return true; } void EGLView::end() { - [DirectorCaller destroy]; + [CCDirectorCaller destroy]; // destroy EAGLView - [[EAGLView sharedEGLView] removeFromSuperview]; + [[CCEAGLView sharedEGLView] removeFromSuperview]; } void EGLView::swapBuffers() { - [[EAGLView sharedEGLView] swapBuffers]; + [[CCEAGLView sharedEGLView] swapBuffers]; } void EGLView::setIMEKeyboardState(bool bOpen) { if (bOpen) { - [[EAGLView sharedEGLView] becomeFirstResponder]; + [[CCEAGLView sharedEGLView] becomeFirstResponder]; } else { - [[EAGLView sharedEGLView] resignFirstResponder]; + [[CCEAGLView sharedEGLView] resignFirstResponder]; } } diff --git a/cocos2dx/platform/ios/EAGLView.h b/cocos2dx/platform/ios/EAGLView.h index 64c83233ab..78868e5ecc 100755 --- a/cocos2dx/platform/ios/EAGLView.h +++ b/cocos2dx/platform/ios/EAGLView.h @@ -77,7 +77,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. * The view content is basically an EAGL surface you render your OpenGL scene into. * Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel. */ -@interface EAGLView : UIView +@interface CCEAGLView : UIView { id renderer_; EAGLContext *context_; // weak ref diff --git a/cocos2dx/platform/ios/EAGLView.mm b/cocos2dx/platform/ios/EAGLView.mm index 096d52a507..485f840fda 100644 --- a/cocos2dx/platform/ios/EAGLView.mm +++ b/cocos2dx/platform/ios/EAGLView.mm @@ -75,14 +75,14 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. #define IOS_MAX_TOUCHES_COUNT 10 -static EAGLView *view = 0; +static CCEAGLView *view = 0; -@interface EAGLView (Private) +@interface CCEAGLView (Private) - (BOOL) setupSurfaceWithSharegroup:(EAGLSharegroup*)sharegroup; - (unsigned int) convertPixelFormat:(NSString*) pixelFormat; @end -@implementation EAGLView +@implementation CCEAGLView @synthesize surfaceSize=size_; @synthesize pixelFormat=pixelformat_, depthFormat=depthFormat_; diff --git a/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.h b/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.h index 6a96cfe944..504b101094 100644 --- a/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.h +++ b/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.h @@ -30,7 +30,7 @@ @end // our own version of the Accelerometer -@interface AccelerometerSimulation : UIAccelerometer +@interface CCAccelerometerSimulation : UIAccelerometer { //CFSocketRef udpSocket; @@ -51,8 +51,8 @@ - (void) setUpThreadingSupport; - (void) handleMachMessage:(void *) msg; - (void) processNotification:(NSNotification *) notification; -+ (AccelerometerSimulation *)getAccelerometer; -- (AccelerometerSimulation *)initialize; ++ (CCAccelerometerSimulation *)getAccelerometer; +- (CCAccelerometerSimulation *)initialize; @end diff --git a/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m b/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m index ce50529583..bcf53d67dd 100644 --- a/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m +++ b/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m @@ -43,7 +43,7 @@ // override the static method and return our simulated version instead + (UIAccelerometer *)sharedAccelerometer { - return [AccelerometerSimulation getAccelerometer]; + return [CCAccelerometerSimulation getAccelerometer]; } #pragma clang diagnostic pop @end @@ -63,9 +63,9 @@ */ // singleton -static AccelerometerSimulation *sharedAccelerometer = NULL; +static CCAccelerometerSimulation *sharedAccelerometer = NULL; -@implementation AccelerometerSimulation +@implementation CCAccelerometerSimulation - (void) dealloc { if (sharedAccelerometer) { @@ -135,10 +135,10 @@ static AccelerometerSimulation *sharedAccelerometer = NULL; [notificationLock unlock]; } #ifndef __clang_analyzer__ -+ (AccelerometerSimulation *)getAccelerometer ++ (CCAccelerometerSimulation *)getAccelerometer { if( sharedAccelerometer == NULL ) - sharedAccelerometer = [[AccelerometerSimulation alloc] initialize]; + sharedAccelerometer = [[CCAccelerometerSimulation alloc] initialize]; return sharedAccelerometer; } @@ -162,7 +162,7 @@ static AccelerometerSimulation *sharedAccelerometer = NULL; } // initialize our version of the accelerometer -- (AccelerometerSimulation *)initialize +- (CCAccelerometerSimulation *)initialize { accObject = [UIAccelerationSimulation alloc]; isExiting = false; diff --git a/cocos2dx/platform/mac/CCApplication.mm b/cocos2dx/platform/mac/CCApplication.mm index 95c3daec03..bf4b9965e2 100644 --- a/cocos2dx/platform/mac/CCApplication.mm +++ b/cocos2dx/platform/mac/CCApplication.mm @@ -50,14 +50,14 @@ int Application::run() { if (/*initInstance() &&*/ applicationDidFinishLaunching()) { - [[DirectorCaller sharedDirectorCaller] startMainLoop]; + [[CCDirectorCaller sharedDirectorCaller] startMainLoop]; } return 0; } void Application::setAnimationInterval(double interval) { - [[DirectorCaller sharedDirectorCaller] setAnimationInterval: interval ]; + [[CCDirectorCaller sharedDirectorCaller] setAnimationInterval: interval ]; } TargetPlatform Application::getTargetPlatform() diff --git a/cocos2dx/platform/mac/CCCommon.mm b/cocos2dx/platform/mac/CCCommon.mm index d546f2e86a..e9d8904724 100644 --- a/cocos2dx/platform/mac/CCCommon.mm +++ b/cocos2dx/platform/mac/CCCommon.mm @@ -63,7 +63,7 @@ void MessageBox(const char * pszMsg, const char * pszTitle) [alert setInformativeText:title]; [alert setAlertStyle:NSWarningAlertStyle]; - NSWindow *window = [[EAGLView sharedEGLView] window]; + NSWindow *window = [[CCEAGLView sharedEGLView] window]; [alert beginSheetModalForWindow:window modalDelegate:[window delegate] didEndSelector:nil diff --git a/cocos2dx/platform/mac/CCDirectorCaller.h b/cocos2dx/platform/mac/CCDirectorCaller.h index 706acb42df..4d80b6e8b5 100644 --- a/cocos2dx/platform/mac/CCDirectorCaller.h +++ b/cocos2dx/platform/mac/CCDirectorCaller.h @@ -24,7 +24,7 @@ #import #import -@interface DirectorCaller : NSObject { +@interface CCDirectorCaller : NSObject { CVDisplayLinkRef displayLink; NSTimer *renderTimer; int interval; diff --git a/cocos2dx/platform/mac/CCDirectorCaller.mm b/cocos2dx/platform/mac/CCDirectorCaller.mm index 434d5dbb47..4270bf0861 100644 --- a/cocos2dx/platform/mac/CCDirectorCaller.mm +++ b/cocos2dx/platform/mac/CCDirectorCaller.mm @@ -37,7 +37,7 @@ static id s_sharedDirectorCaller; -(void) invalidate; @end -@implementation DirectorCaller +@implementation CCDirectorCaller @synthesize interval; @@ -45,7 +45,7 @@ static id s_sharedDirectorCaller; { if (s_sharedDirectorCaller == nil) { - s_sharedDirectorCaller = [[DirectorCaller alloc] init]; + s_sharedDirectorCaller = [[CCDirectorCaller alloc] init]; } return s_sharedDirectorCaller; @@ -81,7 +81,7 @@ static id s_sharedDirectorCaller; cocos2d::Director::sharedDirector()->drawScene(); cocos2d::PoolManager::sharedPoolManager()->pop(); - [[EventDispatcher sharedDispatcher] dispatchQueuedEvents]; + [[CCEventDispatcher sharedDispatcher] dispatchQueuedEvents]; [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:nil]; @@ -115,7 +115,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // get the opengl view - EAGLView *openGLView = [EAGLView sharedEGLView]; + CCEAGLView *openGLView = [CCEAGLView sharedEGLView]; [openGLView lockOpenGLContext]; // run the main cocos2d loop @@ -127,7 +127,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime [openGLView unlockOpenGLContext]; // send any queued events - [[EventDispatcher sharedDispatcher] dispatchQueuedEvents]; + [[CCEventDispatcher sharedDispatcher] dispatchQueuedEvents]; [pool release]; } diff --git a/cocos2dx/platform/mac/CCEGLView.mm b/cocos2dx/platform/mac/CCEGLView.mm index 6289cd0fd8..5a86cde2e6 100644 --- a/cocos2dx/platform/mac/CCEGLView.mm +++ b/cocos2dx/platform/mac/CCEGLView.mm @@ -53,7 +53,7 @@ EGLView::~EGLView(void) bool EGLView::isOpenGLReady(void) { - return [EAGLView sharedEGLView] != NULL; + return [CCEAGLView sharedEGLView] != NULL; } bool EGLView::setContentScaleFactor(float contentScaleFactor) @@ -63,34 +63,34 @@ bool EGLView::setContentScaleFactor(float contentScaleFactor) void EGLView::end(void) { - [[DirectorCaller sharedDirectorCaller] end]; + [[CCDirectorCaller sharedDirectorCaller] end]; // destroy EAGLView - [[EAGLView sharedEGLView] removeFromSuperview]; + [[CCEAGLView sharedEGLView] removeFromSuperview]; delete this; } void EGLView::swapBuffers() { - [[EAGLView sharedEGLView] swapBuffers]; + [[CCEAGLView sharedEGLView] swapBuffers]; } void EGLView::setIMEKeyboardState(bool bOpen) { if (bOpen) { - [[EAGLView sharedEGLView] becomeFirstResponder]; + [[CCEAGLView sharedEGLView] becomeFirstResponder]; } else { - [[EAGLView sharedEGLView] resignFirstResponder]; + [[CCEAGLView sharedEGLView] resignFirstResponder]; } } void EGLView::setViewPortInPoints(float x , float y , float w , float h) { - float frameZoomFactor = [[EAGLView sharedEGLView] frameZoomFactor]; + float frameZoomFactor = [[CCEAGLView sharedEGLView] frameZoomFactor]; glViewport((GLint)(x * _scaleX * frameZoomFactor + _viewPortRect.origin.x * frameZoomFactor), (GLint)(y * _scaleY * frameZoomFactor + _viewPortRect.origin.y * frameZoomFactor), @@ -100,7 +100,7 @@ void EGLView::setViewPortInPoints(float x , float y , float w , float h) void EGLView::setScissorInPoints(float x , float y , float w , float h) { - float frameZoomFactor = [[EAGLView sharedEGLView] frameZoomFactor]; + float frameZoomFactor = [[CCEAGLView sharedEGLView] frameZoomFactor]; glScissor((GLint)(x * _scaleX * frameZoomFactor + _viewPortRect.origin.x * frameZoomFactor), (GLint)(y * _scaleY * frameZoomFactor + _viewPortRect.origin.y * frameZoomFactor), diff --git a/cocos2dx/platform/mac/CCEventDispatcher.h b/cocos2dx/platform/mac/CCEventDispatcher.h index 9aa0f660e8..f3abe69248 100644 --- a/cocos2dx/platform/mac/CCEventDispatcher.h +++ b/cocos2dx/platform/mac/CCEventDispatcher.h @@ -43,7 +43,7 @@ /** MouseEventDelegate protocol. Implement it in your node to receive any of mouse events */ -@protocol MouseEventDelegate +@protocol CCMouseEventDelegate @optional // @@ -141,7 +141,7 @@ /** KeyboardEventDelegate protocol. Implement it in your node to receive any of keyboard events */ -@protocol KeyboardEventDelegate +@protocol CCKeyboardEventDelegate @optional /** called when the "keyUp" event is received. Return YES to avoid propagating the event to other delegates. @@ -164,7 +164,7 @@ /** TouchEventDelegate protocol. Implement it in your node to receive any of touch events */ -@protocol TouchEventDelegate +@protocol CCTouchEventDelegate @optional /** called when the "touchesBegan" event is received. Return YES to avoid propagating the event to other delegates. @@ -203,7 +203,7 @@ struct _listEntry; Only available on Mac */ -@interface EventDispatcher : NSObject { +@interface CCEventDispatcher : NSObject { BOOL dispatchEvents_; @@ -216,7 +216,7 @@ struct _listEntry; /** EventDispatcher singleton */ -+(EventDispatcher*) sharedDispatcher; ++(CCEventDispatcher*) sharedDispatcher; #pragma mark EventDispatcher - Mouse @@ -226,7 +226,7 @@ struct _listEntry; IMPORTANT: The delegate will be retained. */ --(void) addMouseDelegate:(id) delegate priority:(NSInteger)priority; +-(void) addMouseDelegate:(id) delegate priority:(NSInteger)priority; /** removes a mouse delegate */ -(void) removeMouseDelegate:(id) delegate; @@ -242,7 +242,7 @@ struct _listEntry; IMPORTANT: The delegate will be retained. */ --(void) addKeyboardDelegate:(id) delegate priority:(NSInteger)priority; +-(void) addKeyboardDelegate:(id) delegate priority:(NSInteger)priority; /** removes a mouse delegate */ -(void) removeKeyboardDelegate:(id) delegate; @@ -258,7 +258,7 @@ struct _listEntry; IMPORTANT: The delegate will be retained. */ -- (void)addTouchDelegate:(id)delegate priority:(NSInteger)priority; +- (void)addTouchDelegate:(id)delegate priority:(NSInteger)priority; /** Removes a touch delegate */ - (void)removeTouchDelegate:(id) delegate; diff --git a/cocos2dx/platform/mac/CCEventDispatcher.mm b/cocos2dx/platform/mac/CCEventDispatcher.mm index 7acf20a4f7..8f1d2fcdf3 100644 --- a/cocos2dx/platform/mac/CCEventDispatcher.mm +++ b/cocos2dx/platform/mac/CCEventDispatcher.mm @@ -35,7 +35,7 @@ #include "keyboard_dispatcher/CCKeyboardDispatcher.h" //NS_CC_BEGIN; -static EventDispatcher *sharedDispatcher = nil; +static CCEventDispatcher *sharedDispatcher = nil; enum { // mouse @@ -88,12 +88,12 @@ static int eventQueueCount; #endif // CC_DIRECTOR_MAC_USE_DISPLAY_LINK_THREAD -@implementation EventDispatcher +@implementation CCEventDispatcher @synthesize dispatchEvents=dispatchEvents_; -+(EventDispatcher*) sharedDispatcher ++(CCEventDispatcher*) sharedDispatcher { @synchronized(self) { if (sharedDispatcher == nil) @@ -204,7 +204,7 @@ static int eventQueueCount; } --(void) addMouseDelegate:(id) delegate priority:(NSInteger)priority +-(void) addMouseDelegate:(id) delegate priority:(NSInteger)priority { NSUInteger flags = 0; @@ -239,7 +239,7 @@ static int eventQueueCount; [self removeAllDelegatesFromList:&mouseDelegates_]; } --(void) addKeyboardDelegate:(id) delegate priority:(NSInteger)priority +-(void) addKeyboardDelegate:(id) delegate priority:(NSInteger)priority { NSUInteger flags = 0; @@ -260,7 +260,7 @@ static int eventQueueCount; [self removeAllDelegatesFromList:&keyboardDelegates_]; } --(void) addTouchDelegate:(id) delegate priority:(NSInteger)priority +-(void) addTouchDelegate:(id) delegate priority:(NSInteger)priority { NSUInteger flags = 0; diff --git a/cocos2dx/platform/mac/CCImage.mm b/cocos2dx/platform/mac/CCImage.mm index 42b3d2ca3e..68b692cb44 100644 --- a/cocos2dx/platform/mac/CCImage.mm +++ b/cocos2dx/platform/mac/CCImage.mm @@ -73,14 +73,6 @@ typedef enum { kTexture2DPixelFormat_Default = kTexture2DPixelFormat_RGBA8888, // backward compatibility stuff - kTexture2DPixelFormat_Automatic = kTexture2DPixelFormat_Automatic, - kTexture2DPixelFormat_RGBA8888 = kTexture2DPixelFormat_RGBA8888, - kTexture2DPixelFormat_RGB888 = kTexture2DPixelFormat_RGB888, - kTexture2DPixelFormat_RGB565 = kTexture2DPixelFormat_RGB565, - kTexture2DPixelFormat_A8 = kTexture2DPixelFormat_A8, - kTexture2DPixelFormat_RGBA4444 = kTexture2DPixelFormat_RGBA4444, - kTexture2DPixelFormat_RGB5A1 = kTexture2DPixelFormat_RGB5A1, - kTexture2DPixelFormat_Default = kTexture2DPixelFormat_Default } Texture2DPixelFormat; diff --git a/cocos2dx/platform/mac/CCWindow.h b/cocos2dx/platform/mac/CCWindow.h index e15ee3d4e6..8e24b8a858 100644 --- a/cocos2dx/platform/mac/CCWindow.h +++ b/cocos2dx/platform/mac/CCWindow.h @@ -28,7 +28,7 @@ THE SOFTWARE. #import -@interface Window : NSWindow +@interface CCWindow : NSWindow { } - (id) initWithFrame:(NSRect)frame fullscreen:(BOOL)fullscreen; diff --git a/cocos2dx/platform/mac/CCWindow.m b/cocos2dx/platform/mac/CCWindow.m index ffec27d802..29e4a2d309 100644 --- a/cocos2dx/platform/mac/CCWindow.m +++ b/cocos2dx/platform/mac/CCWindow.m @@ -65,7 +65,7 @@ THE SOFTWARE. // exit fullscreen if user pressed esc if([event keyCode] == 53) { - EAGLView* eaglView = [EAGLView sharedEGLView]; + CCEAGLView* eaglView = [CCEAGLView sharedEGLView]; // cancel full screen if( [eaglView isFullScreen] ) diff --git a/cocos2dx/platform/mac/EAGLView.h b/cocos2dx/platform/mac/EAGLView.h index 76805c67aa..0be91c9b09 100755 --- a/cocos2dx/platform/mac/EAGLView.h +++ b/cocos2dx/platform/mac/EAGLView.h @@ -30,7 +30,7 @@ THE SOFTWARE. //PROTOCOLS: -@protocol MacEventDelegate +@protocol CCMacEventDelegate // Mouse - (void)mouseDown:(NSEvent *)theEvent; - (void)mouseUp:(NSEvent *)theEvent; @@ -68,8 +68,8 @@ THE SOFTWARE. Only available for Mac OS X */ -@interface EAGLView : NSOpenGLView { - id eventDelegate_; +@interface CCEAGLView : NSOpenGLView { + id eventDelegate_; BOOL isFullScreen_; NSWindow *fullScreenWindow_; @@ -82,7 +82,7 @@ THE SOFTWARE. float frameZoomFactor_; } -@property (nonatomic, readwrite, assign) id eventDelegate; +@property (nonatomic, readwrite, assign) id eventDelegate; // whether or not the view is in fullscreen mode @property (nonatomic, readonly) BOOL isFullScreen; diff --git a/cocos2dx/platform/mac/EAGLView.mm b/cocos2dx/platform/mac/EAGLView.mm index 2f66d1f0ce..2eaf4b95af 100644 --- a/cocos2dx/platform/mac/EAGLView.mm +++ b/cocos2dx/platform/mac/EAGLView.mm @@ -42,9 +42,9 @@ THE SOFTWARE. //USING_NS_CC; -static EAGLView *view; +static CCEAGLView *view; -@implementation EAGLView +@implementation CCEAGLView @synthesize eventDelegate = eventDelegate_, isFullScreen = isFullScreen_, frameZoomFactor=frameZoomFactor_; @@ -82,7 +82,7 @@ static EAGLView *view; [self setOpenGLContext:context]; // event delegate - eventDelegate_ = [EventDispatcher sharedDispatcher]; + eventDelegate_ = [CCEventDispatcher sharedDispatcher]; } cocos2d::EGLView::sharedOpenGLView()->setFrameSize(frameRect.size.width, frameRect.size.height); @@ -95,7 +95,7 @@ static EAGLView *view; - (id) initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat *)format{ // event delegate - eventDelegate_ = [EventDispatcher sharedDispatcher]; + eventDelegate_ = [CCEventDispatcher sharedDispatcher]; cocos2d::EGLView::sharedOpenGLView()->setFrameSize(frameRect.size.width, frameRect.size.height); @@ -232,7 +232,7 @@ static EAGLView *view; if (isFullScreen_ == fullscreen) return; - EAGLView *openGLview = [[self class] sharedEGLView]; + CCEAGLView *openGLview = [[self class] sharedEGLView]; if( fullscreen ) { originalWinRect_ = [openGLview frame]; @@ -249,7 +249,7 @@ static EAGLView *view; NSRect displayRect = [[NSScreen mainScreen] frame]; // Create a screen-sized window on the display you want to take over - fullScreenWindow_ = [[Window alloc] initWithFrame:displayRect fullscreen:YES]; + fullScreenWindow_ = [[CCWindow alloc] initWithFrame:displayRect fullscreen:YES]; // Remove glView from window [openGLview removeFromSuperview]; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h index 89c0f9614a..4e4ada0d3c 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h @@ -36,16 +36,16 @@ #import #import -@interface CustomUITextField : UITextField +@interface CCCustomUITextField : UITextField { } @end -@interface EditBoxImplIOS_objc : NSObject +@interface CCEditBoxImplIOS_objc : NSObject { - CustomUITextField* textField_; + CCCustomUITextField* textField_; void* editBox_; BOOL editState_; } @@ -112,7 +112,7 @@ private: Size _contentSize; Point _position; Point _anchorPoint; - EditBoxImplIOS_objc* _systemControl; + CCEditBoxImplIOS_objc* _systemControl; int _maxTextLength; bool _inRetinaMode; }; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 7845d93ce4..deb5644850 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -35,9 +35,9 @@ static const int CC_EDIT_BOX_PADDING = 5; -@implementation CustomUITextField +@implementation CCCustomUITextField - (CGRect)textRectForBounds:(CGRect)bounds { - float padding = CC_EDIT_BOX_PADDING * cocos2d::EGLView::sharedOpenGLView()->getScaleX() / [[EAGLView sharedEGLView] contentScaleFactor ]; + float padding = CC_EDIT_BOX_PADDING * cocos2d::EGLView::sharedOpenGLView()->getScaleX() / [[CCEAGLView sharedEGLView] contentScaleFactor ]; return CGRectMake(bounds.origin.x + padding, bounds.origin.y + padding, bounds.size.width - padding*2, bounds.size.height - padding*2); } @@ -47,7 +47,7 @@ static const int CC_EDIT_BOX_PADDING = 5; @end -@implementation EditBoxImplIOS_objc +@implementation CCEditBoxImplIOS_objc @synthesize textField = textField_; @synthesize editState = editState_; @@ -69,7 +69,7 @@ static const int CC_EDIT_BOX_PADDING = 5; { if (self == nil) break; editState_ = NO; - self.textField = [[[CustomUITextField alloc] initWithFrame: frameRect] autorelease]; + self.textField = [[[CCCustomUITextField alloc] initWithFrame: frameRect] autorelease]; if (!textField_) break; [textField_ setTextColor:[UIColor whiteColor]]; textField_.font = [UIFont systemFontOfSize:frameRect.size.height*2/3]; //TODO need to delete hard code here. @@ -91,7 +91,7 @@ static const int CC_EDIT_BOX_PADDING = 5; -(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance { - id eglView = [EAGLView sharedEGLView]; + id eglView = [CCEAGLView sharedEGLView]; [eglView doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; } @@ -116,7 +116,7 @@ static const int CC_EDIT_BOX_PADDING = 5; -(void) openKeyboard { - [[EAGLView sharedEGLView] addSubview:textField_]; + [[CCEAGLView sharedEGLView] addSubview:textField_]; [textField_ becomeFirstResponder]; } @@ -136,7 +136,7 @@ static const int CC_EDIT_BOX_PADDING = 5; -(void)animationSelector { - id eglView = [EAGLView sharedEGLView]; + id eglView = [CCEAGLView sharedEGLView]; [eglView doAnimationWhenAnotherEditBeClicked]; } @@ -144,7 +144,7 @@ static const int CC_EDIT_BOX_PADDING = 5; { CCLOG("textFieldShouldBeginEditing..."); editState_ = YES; - id eglView = [EAGLView sharedEGLView]; + id eglView = [CCEAGLView sharedEGLView]; if ([eglView isKeyboardShown]) { [self performSelector:@selector(animationSelector) withObject:nil afterDelay:0.0f]; @@ -254,7 +254,7 @@ EditBoxImplIOS::EditBoxImplIOS(EditBox* pEditText) , _anchorPoint(ccp(0.5f, 0.5f)) , _maxTextLength(-1) { - _inRetinaMode = [[EAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false; + _inRetinaMode = [[CCEAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false; } EditBoxImplIOS::~EditBoxImplIOS() @@ -284,7 +284,7 @@ bool EditBoxImplIOS::initWithSize(const Size& size) rect.size.height /= 2.0f; } - _systemControl = [[EditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this]; + _systemControl = [[CCEditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this]; if (!_systemControl) break; initInactiveLabels(size); @@ -510,7 +510,7 @@ void EditBoxImplIOS::setPlaceHolder(const char* pText) static CGPoint convertDesignCoordToScreenCoord(const Point& designCoord, bool bInRetinaMode) { EGLViewProtocol* eglView = EGLView::sharedOpenGLView(); - float viewH = (float)[[EAGLView sharedEGLView] getHeight]; + float viewH = (float)[[CCEAGLView sharedEGLView] getHeight]; Point visiblePos = ccp(designCoord.x * eglView->getScaleX(), designCoord.y * eglView->getScaleY()); Point screenGLPos = ccpAdd(visiblePos, eglView->getViewPortRect().origin); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.h b/extensions/GUI/CCEditBox/CCEditBoxImplMac.h index 7dc44dbd76..ee4ddbd1fd 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.h @@ -36,15 +36,15 @@ #include "ExtensionMacros.h" #include "CCEditBoxImpl.h" -@interface CustomNSTextField : NSTextField +@interface CCCustomNSTextField : NSTextField { } @end -@interface EditBoxImplMac : NSObject +@interface CCEditBoxImplMac : NSObject { - CustomNSTextField* textField_; + CCCustomNSTextField* textField_; void* editBox_; BOOL editState_; } @@ -105,7 +105,7 @@ private: Point _anchorPoint; int _maxTextLength; bool _inRetinaMode; - EditBoxImplMac* _sysEdit; + CCEditBoxImplMac* _sysEdit; }; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index 49802ca423..e693532402 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -32,7 +32,7 @@ #define getEditBoxImplMac() ((cocos2d::extension::EditBoxImplMac*)editBox_) -@implementation CustomNSTextField +@implementation CCCustomNSTextField - (CGRect)textRectForBounds:(CGRect)bounds { float padding = 5.0f; @@ -52,7 +52,7 @@ @end -@implementation EditBoxImplMac +@implementation CCEditBoxImplMac @synthesize textField = textField_; @synthesize editState = editState_; @@ -74,7 +74,7 @@ { if (self == nil) break; editState_ = NO; - self.textField = [[[CustomNSTextField alloc] initWithFrame: frameRect] autorelease]; + self.textField = [[[CCCustomNSTextField alloc] initWithFrame: frameRect] autorelease]; if (!textField_) break; [textField_ setTextColor:[NSColor whiteColor]]; textField_.font = [NSFont systemFontOfSize:frameRect.size.height*2/3]; //TODO need to delete hard code here. @@ -84,7 +84,7 @@ [textField_ setDelegate:self]; self.editBox = editBox; - [[EAGLView sharedEGLView] addSubview:textField_]; + [[CCEAGLView sharedEGLView] addSubview:textField_]; return self; }while(0); @@ -94,7 +94,7 @@ -(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance { - id eglView = [EAGLView sharedEGLView]; + id eglView = [CCEAGLView sharedEGLView]; [eglView doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; } @@ -258,7 +258,7 @@ bool EditBoxImplMac::initWithSize(const Size& size) rect.size.height /= 2.0f; } - _sysEdit = [[EditBoxImplMac alloc] initWithFrame:rect editBox:this]; + _sysEdit = [[CCEditBoxImplMac alloc] initWithFrame:rect editBox:this]; if (!_sysEdit) return false; diff --git a/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm b/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm index ab308b0e94..6ffb561bd5 100644 --- a/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm +++ b/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm @@ -29,7 +29,7 @@ static AppDelegate s_sharedApplication; window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; // Init the EAGLView - EAGLView *__glView = [EAGLView viewWithFrame: [window bounds] + CCEAGLView *__glView = [CCEAGLView viewWithFrame: [window bounds] pixelFormat: kEAGLColorFormatRGB565 depthFormat: GL_DEPTH24_STENCIL8_OES preserveBackbuffer: NO diff --git a/samples/Cpp/TestCpp/proj.mac/AppController.h b/samples/Cpp/TestCpp/proj.mac/AppController.h index d671ffdc23..96c717304b 100644 --- a/samples/Cpp/TestCpp/proj.mac/AppController.h +++ b/samples/Cpp/TestCpp/proj.mac/AppController.h @@ -30,11 +30,11 @@ @interface AppController : NSObject { NSWindow *window; - EAGLView *glView; + CCEAGLView *glView; } @property (nonatomic, assign) IBOutlet NSWindow* window; - @property (nonatomic, assign) IBOutlet EAGLView* glView; + @property (nonatomic, assign) IBOutlet CCEAGLView* glView; -(IBAction) toggleFullScreen:(id)sender; -(IBAction) exitFullScreen:(id)sender; diff --git a/samples/Cpp/TestCpp/proj.mac/AppController.mm b/samples/Cpp/TestCpp/proj.mac/AppController.mm index 26ec7fa12c..e02da4978a 100644 --- a/samples/Cpp/TestCpp/proj.mac/AppController.mm +++ b/samples/Cpp/TestCpp/proj.mac/AppController.mm @@ -53,7 +53,7 @@ // allocate our GL view // (isn't there already a shared EAGLView?) - glView = [[EAGLView alloc] initWithFrame:rect pixelFormat:pixelFormat]; + glView = [[CCEAGLView alloc] initWithFrame:rect pixelFormat:pixelFormat]; // set window parameters [window becomeFirstResponder]; @@ -81,13 +81,13 @@ -(IBAction) toggleFullScreen:(id)sender { - EAGLView* pView = [EAGLView sharedEGLView]; + CCEAGLView* pView = [CCEAGLView sharedEGLView]; [pView setFullScreen:!pView.isFullScreen]; } -(IBAction) exitFullScreen:(id)sender { - [[EAGLView sharedEGLView] setFullScreen:NO]; + [[CCEAGLView sharedEGLView] setFullScreen:NO]; } @end