Skip to content

fix issue 375 #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
Mar 9, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion HelloWorld/ios/AppController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

[[UIApplication sharedApplication] setStatusBarHidden: YES];

cocos2d::ccxApplication::sharedApplication().run();
cocos2d::CCApplication::sharedApplication().run();
return YES;
}

Expand Down
3,502 changes: 2,530 additions & 972 deletions HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions cocos2dx/platform/ios/AccelerometerDelegateWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
****************************************************************************/

#import <Foundation/Foundation.h>
#import "CCUIAccelerometerDelegate.h"
#import "CCAccelerometerDelegate.h"
#import <UIKit/UIKit.h>

@interface AccelerometerDispatcher : NSObject<UIAccelerometerDelegate>
Expand All @@ -35,20 +35,20 @@

+ (id) sharedAccelerometerDispather;
- (id) init;
- (void) addDelegate: (cocos2d::UIAccelerometerDelegate *) delegate;
- (void) removeDelegate: (cocos2d::UIAccelerometerDelegate *) delegate;
- (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate;
- (void) removeDelegate: (cocos2d::CCAccelerometerDelegate *) delegate;

@end


@interface AccelerometerDelegateWrapper : NSObject {
cocos2d::UIAccelerometerDelegate *delegate_;
cocos2d::CCAccelerometerDelegate *delegate_;
}

@property(readwrite) cocos2d::UIAccelerometerDelegate *delegate_;
@property(readwrite) cocos2d::CCAccelerometerDelegate *delegate_;

+ (id) delegateWrapperWithDelegate:(cocos2d::UIAccelerometerDelegate *)delegate;
- (id) initWithDelegate: (cocos2d::UIAccelerometerDelegate *)delegate;
- (void) didAccelerate: (cocos2d::UIAcceleration *)acceleration;
+ (id) delegateWrapperWithDelegate:(cocos2d::CCAccelerometerDelegate *)delegate;
- (id) initWithDelegate: (cocos2d::CCAccelerometerDelegate *)delegate;
- (void) didAccelerate: (cocos2d::CCAcceleration *)acceleration;

@end
14 changes: 7 additions & 7 deletions cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (void) dealloc
[super dealloc];
}

- (id) findDelegateWrapperByDelegate: (cocos2d::UIAccelerometerDelegate *) delegate
- (id) findDelegateWrapperByDelegate: (cocos2d::CCAccelerometerDelegate *) delegate
{
for (AccelerometerDelegateWrapper *wrapper in delegateWrappers) {
if (wrapper.delegate_ == delegate) {
Expand All @@ -65,19 +65,19 @@ - (id) findDelegateWrapperByDelegate: (cocos2d::UIAccelerometerDelegate *) deleg
return nil;
}

- (void) addDelegate: (cocos2d::UIAccelerometerDelegate *) delegate
- (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate
{
[delegateWrappers addObject: [AccelerometerDelegateWrapper delegateWrapperWithDelegate:delegate]];
}

- (void) removeDelegate: (cocos2d::UIAccelerometerDelegate *) delegate
- (void) removeDelegate: (cocos2d::CCAccelerometerDelegate *) delegate
{
[delegateWrappers removeObject:[self findDelegateWrapperByDelegate:delegate]];
}

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
cocos2d::UIAcceleration accelerationCpp;
cocos2d::CCAcceleration accelerationCpp;

accelerationCpp.x = acceleration.x;
accelerationCpp.y = acceleration.y;
Expand All @@ -96,20 +96,20 @@ @implementation AccelerometerDelegateWrapper

@synthesize delegate_;

+ (id)delegateWrapperWithDelegate:(cocos2d::UIAccelerometerDelegate *)delegate
+ (id)delegateWrapperWithDelegate:(cocos2d::CCAccelerometerDelegate *)delegate
{
return [[self alloc] initWithDelegate: delegate];
}

- (id) initWithDelegate: (cocos2d::UIAccelerometerDelegate *)delegate
- (id) initWithDelegate: (cocos2d::CCAccelerometerDelegate *)delegate
{
delegate->AccelerometerKeep();
self.delegate_ = delegate;

return self;
}

- (void) didAccelerate: (cocos2d::UIAcceleration *)acceleration
- (void) didAccelerate: (cocos2d::CCAcceleration *)acceleration
{
self.delegate_->didAccelerate(acceleration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

#ifndef __PLATFORM_IPHONE_UIACCELEROMETER_H__
#define __PLATFORM_IPHONE_UIACCELEROMETER_H__
#ifndef __PLATFORM_IPHONE_CCACCELEROMETER_H__
#define __PLATFORM_IPHONE_CCACCELEROMETER_H__

#include "CCUIAccelerometerDelegate.h"
#include "CCAccelerometerDelegate.h"

namespace cocos2d {

class CCX_DLL UIAccelerometer
class CC_DLL CCAccelerometer
{
public:
UIAccelerometer();
~UIAccelerometer();
CCAccelerometer();
~CCAccelerometer();

static UIAccelerometer* sharedAccelerometer();
static CCAccelerometer* sharedAccelerometer();

void removeDelegate(UIAccelerometerDelegate* pDelegate);
void addDelegate(UIAccelerometerDelegate* pDelegate);
void removeDelegate(CCAccelerometerDelegate* pDelegate);
void addDelegate(CCAccelerometerDelegate* pDelegate);

private:
static UIAccelerometer* m_spUIAccelerometer;
static CCAccelerometer* m_spUIAccelerometer;
};

}//namespace cocos2d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@ of this software and associated documentation files (the "Software"), to deal
THE SOFTWARE.
****************************************************************************/

#include "CCXUIAccelerometer.h"
#include "CCAccelerometer.h"
#include "AccelerometerDelegateWrapper.h"

namespace cocos2d {

UIAccelerometer* UIAccelerometer::m_spUIAccelerometer = NULL;
CCAccelerometer* CCAccelerometer::m_spUIAccelerometer = NULL;

UIAccelerometer::UIAccelerometer()
CCAccelerometer::CCAccelerometer()
{
}

UIAccelerometer::~UIAccelerometer()
CCAccelerometer::~CCAccelerometer()
{
}

UIAccelerometer* UIAccelerometer::sharedAccelerometer()
CCAccelerometer* CCAccelerometer::sharedAccelerometer()
{
if (m_spUIAccelerometer == NULL) {
m_spUIAccelerometer = new UIAccelerometer();
m_spUIAccelerometer = new CCAccelerometer();
}

return m_spUIAccelerometer;
}

void UIAccelerometer::removeDelegate(UIAccelerometerDelegate* pDelegate)
void CCAccelerometer::removeDelegate(CCAccelerometerDelegate* pDelegate)
{
[[AccelerometerDispatcher sharedAccelerometerDispather] removeDelegate:pDelegate];
}

void UIAccelerometer::addDelegate(UIAccelerometerDelegate* pDelegate)
void CCAccelerometer::addDelegate(CCAccelerometerDelegate* pDelegate)
{
[[AccelerometerDispatcher sharedAccelerometerDispather] addDelegate:pDelegate];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

#ifndef __CCX_APPLICATION_IOS_H__
#define __CCX_APPLICATION_IOS_H__
#ifndef __CC_APPLICATION_IOS_H__
#define __CC_APPLICATION_IOS_H__

#include "ccxCommon.h"
#include "CCCommon.h"

NS_CC_BEGIN;

class CGRect;
class CCRect;

class CCX_DLL ccxApplication
class CC_DLL CCApplication
{
public:
ccxApplication();
virtual ~ccxApplication();
CCApplication();
virtual ~CCApplication();

/**
@brief Implement for initialize OpenGL instance, set source path, etc...
Expand Down Expand Up @@ -89,7 +89,7 @@ class CCX_DLL ccxApplication
/**
@brief Get status bar rectangle in EGLView window.
*/
void statusBarFrame(CGRect * rect);
void statusBarFrame(CCRect * rect);

/**
@brief Run the message loop.
Expand All @@ -100,12 +100,12 @@ class CCX_DLL ccxApplication
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static ccxApplication& sharedApplication();
static CCApplication& sharedApplication();

protected:
static ccxApplication * sm_pSharedApplication;
static CCApplication * sm_pSharedApplication;
};

NS_CC_END;

#endif // end of __CCX_APPLICATION_IOS_H__
#endif // end of __CC_APPLICATION_IOS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ of this software and associated documentation files (the "Software"), to deal
THE SOFTWARE.
****************************************************************************/

#import "ccxApplication_ios.h"
#import "CCApplication_ios.h"

#import <UIKit/UIKit.h>

#import "CGGeometry.h"
#import "CCGeometry.h"
#import "CCDirectorCaller.h"

NS_CC_BEGIN;

ccxApplication* ccxApplication::sm_pSharedApplication = 0;
CCApplication* CCApplication::sm_pSharedApplication = 0;

ccxApplication::ccxApplication()
CCApplication::CCApplication()
{
CCX_ASSERT(! sm_pSharedApplication);
CC_ASSERT(! sm_pSharedApplication);
sm_pSharedApplication = this;
}

ccxApplication::~ccxApplication()
CCApplication::~CCApplication()
{
CCX_ASSERT(this == sm_pSharedApplication);
CC_ASSERT(this == sm_pSharedApplication);
sm_pSharedApplication = 0;
}

int ccxApplication::run()
int CCApplication::run()
{
if (initInstance() && applicationDidFinishLaunching())
{
Expand All @@ -54,12 +54,12 @@ of this software and associated documentation files (the "Software"), to deal
return 0;
}

void ccxApplication::setAnimationInterval(double interval)
void CCApplication::setAnimationInterval(double interval)
{
[[CCDirectorCaller sharedDirectorCaller] setAnimationInterval: interval ];
}

ccxApplication::Orientation ccxApplication::setOrientation(Orientation eOritation)
CCApplication::Orientation CCApplication::setOrientation(Orientation eOritation)
{
UIApplication * app = [UIApplication sharedApplication];
UIInterfaceOrientation newOrientation;
Expand Down Expand Up @@ -88,7 +88,7 @@ of this software and associated documentation files (the "Software"), to deal
return eOritation;
}

void ccxApplication::statusBarFrame(cocos2d::CGRect * rect)
void CCApplication::statusBarFrame(cocos2d::CCRect * rect)
{
rect->origin.x = [[UIApplication sharedApplication] statusBarFrame].origin.x;
rect->origin.y = [[UIApplication sharedApplication] statusBarFrame].origin.y;
Expand All @@ -100,9 +100,9 @@ of this software and associated documentation files (the "Software"), to deal
// static member function
//////////////////////////////////////////////////////////////////////////////////////////////////

ccxApplication& ccxApplication::sharedApplication()
CCApplication& CCApplication::sharedApplication()
{
CCX_ASSERT(sm_pSharedApplication);
CC_ASSERT(sm_pSharedApplication);
return *sm_pSharedApplication;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,24 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

#ifndef __CCX_EGLVIEW_IPHONE_H__
#define __CCX_EGLVIEW_IPHONE_H__
#ifndef __CC_EGLVIEW_IPHONE_H__
#define __CC_EGLVIEW_IPHONE_H__

//#include "CGGeometry.h"
#include "ccxCommon.h"
#include "CCCommon.h"

namespace cocos2d {
class NSSet;
class CCSet;
class CCTouch;
class EGLTouchDelegate;
class CGSize;
class CCSize;

class CCX_DLL CCXEGLView
class CC_DLL CCEGLView
{
public:
CCXEGLView();
~CCXEGLView();
CCEGLView();
~CCEGLView();

CGSize getSize();
CCSize getSize();
bool isOpenGLReady();
bool canSetContentScaleFactor();
void setContentScaleFactor(float contentScaleFactor);
Expand All @@ -51,17 +50,17 @@ class CCX_DLL CCXEGLView
void swapBuffers();
void setViewPortInPoints(float x, float y, float w, float h);

void touchesBegan(NSSet *set);
void touchesMoved(NSSet *set);
void touchesEnded(NSSet *set);
void touchesCancelled(NSSet *set);
void touchesBegan(CCSet *set);
void touchesMoved(CCSet *set);
void touchesEnded(CCSet *set);
void touchesCancelled(CCSet *set);

static CCXEGLView& sharedOpenGLView();
static CCEGLView& sharedOpenGLView();

private:
EGLTouchDelegate *m_pDelegate;
};

} // end of namespace cocos2d

#endif // end of __CCX_EGLVIEW_IPHONE_H__
#endif // end of __CC_EGLVIEW_IPHONE_H__
Loading