From fac3e9c8de8da6e9733693192c35c34bd3f39719 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 21 Aug 2012 17:25:03 +0800 Subject: [PATCH] issue #1437: fixed some compile errors. --- cocos2dx/platform/win32/CCAccelerometer.cpp | 4 ++-- cocos2dx/platform/win32/CCApplication.cpp | 4 ++-- cocos2dx/platform/win32/CCApplication.h | 2 +- cocos2dx/platform/win32/CCEGLView.cpp | 4 ++-- samples/HelloCpp/proj.win32/main.cpp | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cocos2dx/platform/win32/CCAccelerometer.cpp b/cocos2dx/platform/win32/CCAccelerometer.cpp index 58bee51739..569d12cfcf 100644 --- a/cocos2dx/platform/win32/CCAccelerometer.cpp +++ b/cocos2dx/platform/win32/CCAccelerometer.cpp @@ -168,12 +168,12 @@ void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) if (pDelegate) { // Register our handler - CCEGLView::sharedOpenGLView().setAccelerometerKeyHook( &myAccelerometerKeyHook ); + CCEGLView::sharedOpenGLView()->setAccelerometerKeyHook( &myAccelerometerKeyHook ); } else { // De-register our handler - CCEGLView::sharedOpenGLView().setAccelerometerKeyHook( NULL ); + CCEGLView::sharedOpenGLView()->setAccelerometerKeyHook( NULL ); resetAccelerometer(); } } diff --git a/cocos2dx/platform/win32/CCApplication.cpp b/cocos2dx/platform/win32/CCApplication.cpp index fda1ac7311..d77a93a85b 100644 --- a/cocos2dx/platform/win32/CCApplication.cpp +++ b/cocos2dx/platform/win32/CCApplication.cpp @@ -99,10 +99,10 @@ void CCApplication::setAnimationInterval(double interval) ////////////////////////////////////////////////////////////////////////// // static member function ////////////////////////////////////////////////////////////////////////// -CCApplication& CCApplication::sharedApplication() +CCApplication* CCApplication::sharedApplication() { CC_ASSERT(sm_pSharedApplication); - return *sm_pSharedApplication; + return sm_pSharedApplication; } ccLanguageType CCApplication::getCurrentLanguage() diff --git a/cocos2dx/platform/win32/CCApplication.h b/cocos2dx/platform/win32/CCApplication.h index 1edb3bb607..8e05740002 100644 --- a/cocos2dx/platform/win32/CCApplication.h +++ b/cocos2dx/platform/win32/CCApplication.h @@ -24,7 +24,7 @@ public: @brief Get current applicaiton instance. @return Current application instance pointer. */ - static CCApplication& sharedApplication(); + static CCApplication* sharedApplication(); /* override functions */ virtual void setAnimationInterval(double interval); diff --git a/cocos2dx/platform/win32/CCEGLView.cpp b/cocos2dx/platform/win32/CCEGLView.cpp index 754bae910b..8158f928c8 100644 --- a/cocos2dx/platform/win32/CCEGLView.cpp +++ b/cocos2dx/platform/win32/CCEGLView.cpp @@ -248,10 +248,10 @@ LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) switch (wParam) { case SIZE_RESTORED: - CCApplication::sharedApplication().applicationWillEnterForeground(); + CCApplication::sharedApplication()->applicationWillEnterForeground(); break; case SIZE_MINIMIZED: - CCApplication::sharedApplication().applicationDidEnterBackground(); + CCApplication::sharedApplication()->applicationDidEnterBackground(); break; } break; diff --git a/samples/HelloCpp/proj.win32/main.cpp b/samples/HelloCpp/proj.win32/main.cpp index b876619ed6..2b81f7841a 100644 --- a/samples/HelloCpp/proj.win32/main.cpp +++ b/samples/HelloCpp/proj.win32/main.cpp @@ -14,7 +14,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - CCEGLView& eglView = CCEGLView::sharedOpenGLView(); - eglView.setFrameSize(960, 640 ); - return CCApplication::sharedApplication().run(); + CCEGLView* eglView = CCEGLView::sharedOpenGLView(); + eglView->setFrameSize(960, 640 ); + return CCApplication::sharedApplication()->run(); }