Merge pull request #3151 from dumganhar/iss2397-getInstance

issue #2397: Application::sharedApplication --> Application::getInstance and mark Application::sharedApplication as deprecated function.
This commit is contained in:
James Chen 2013-07-15 01:58:37 -07:00
commit 17a6b58f11
129 changed files with 261 additions and 169 deletions

View File

@ -1058,7 +1058,7 @@ void DisplayLinkDirector::startAnimation(void)
_invalid = false;
#ifndef EMSCRIPTEN
Application::sharedApplication()->setAnimationInterval(_animationInterval);
Application::getInstance()->setAnimationInterval(_animationInterval);
#endif // EMSCRIPTEN
}

View File

@ -55,12 +55,18 @@ void Application::setAnimationInterval(double interval)
//////////////////////////////////////////////////////////////////////////
// static member function
//////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CCAssert(sm_pSharedApplication, "");
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
std::string languageName = getCurrentLanguageJNI();

View File

@ -29,7 +29,10 @@ public:
@brief Get current application instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/**
@brief Get current language config

View File

@ -15,14 +15,14 @@ extern "C" {
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause() {
Application::sharedApplication()->applicationDidEnterBackground();
Application::getInstance()->applicationDidEnterBackground();
NotificationCenter::getInstance()->postNotification(EVENT_COME_TO_BACKGROUND, NULL);
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume() {
if (Director::getInstance()->getOpenGLView()) {
Application::sharedApplication()->applicationWillEnterForeground();
Application::getInstance()->applicationWillEnterForeground();
}
}

View File

@ -101,12 +101,18 @@ TargetPlatform Application::getTargetPlatform()
//////////////////////////////////////////////////////////////////////////
// static member function
//////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CC_ASSERT(sm_pSharedApplication);
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
ccLanguageType ret_language = kLanguageEnglish;

View File

@ -29,8 +29,11 @@ public:
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/**
@brief Get current language config
@return Current language config

View File

@ -625,7 +625,7 @@ bool EGLView::handleEvents()
case NAVIGATOR_WINDOW_INACTIVE:
if (_isWindowActive)
{
Application::sharedApplication()->applicationDidEnterBackground();
Application::getInstance()->applicationDidEnterBackground();
_isWindowActive = false;
}
break;
@ -633,7 +633,7 @@ bool EGLView::handleEvents()
case NAVIGATOR_WINDOW_ACTIVE:
if (!_isWindowActive)
{
Application::sharedApplication()->applicationWillEnterForeground();
Application::getInstance()->applicationWillEnterForeground();
_isWindowActive = true;
}
break;
@ -645,14 +645,14 @@ bool EGLView::handleEvents()
case NAVIGATOR_WINDOW_FULLSCREEN:
if (!_isWindowActive)
{
Application::sharedApplication()->applicationWillEnterForeground();
Application::getInstance()->applicationWillEnterForeground();
_isWindowActive = true;
}
break;
case NAVIGATOR_WINDOW_THUMBNAIL:
if (_isWindowActive)
{
Application::sharedApplication()->applicationDidEnterBackground();
Application::getInstance()->applicationDidEnterBackground();
_isWindowActive = false;
}
break;

View File

@ -93,12 +93,18 @@ TargetPlatform Application::getTargetPlatform()
//////////////////////////////////////////////////////////////////////////
// static member function
//////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CC_ASSERT(sm_pSharedApplication);
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
return kLanguageEnglish;

View File

@ -29,8 +29,11 @@ public:
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/**
@brief Get current language config
@return Current language config

View File

@ -47,7 +47,10 @@ public:
@brief Get the current application instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/**
@brief Callback by Director for limit FPS.

View File

@ -63,12 +63,18 @@ void Application::setAnimationInterval(double interval)
// static member function
//////////////////////////////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CC_ASSERT(sm_pSharedApplication);
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
// get the current language and country config

View File

@ -92,12 +92,18 @@ TargetPlatform Application::getTargetPlatform()
//////////////////////////////////////////////////////////////////////////
// static member function
//////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CC_ASSERT(sm_pSharedApplication);
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
char *pLanguageName = getenv("LANG");

View File

@ -36,8 +36,11 @@ public:
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/* override functions */
virtual ccLanguageType getCurrentLanguage();

View File

@ -56,8 +56,11 @@ public:
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/**
@brief Get current language config
@return Current language config

View File

@ -69,12 +69,18 @@ TargetPlatform Application::getTargetPlatform()
// static member function
//////////////////////////////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CCAssert(sm_pSharedApplication, "sm_pSharedApplication not set");
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
// get the current language and country config

View File

@ -130,12 +130,18 @@ void Application::ccAccelerationUpdate()
//////////////////////////////////////////////////////////////////////////
// static member function
//////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication() // MH Cocos2dx Director class expects this to return a pointer and not a reference
Application* Application::getInstance() // MH Cocos2dx Director class expects this to return a pointer and not a reference
{
CC_ASSERT(sm_pSharedApplication);
return sm_pSharedApplication; // MH Cocos2dx Director class expects this to return a pointer and not a reference
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
int nLanguageIdx;

View File

@ -77,8 +77,11 @@ public:
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static Application* sharedApplication(); // MH Cocos2dx Director class expects this to return a pointer and not a reference
static Application* getInstance(); // MH Cocos2dx Director class expects this to return a pointer and not a reference
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/**
@brief Get current language config
@return Current language config

View File

@ -95,12 +95,18 @@ TargetPlatform Application::getTargetPlatform()
return kTargetNaCl;
}
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CC_ASSERT(sm_pSharedApplication);
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
ccLanguageType ret = kLanguageEnglish;

View File

@ -52,8 +52,11 @@ public:
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/* override functions */
virtual ccLanguageType getCurrentLanguage();

View File

@ -72,12 +72,18 @@ long Application::getAnimationInterval()
//////////////////////////////////////////////////////////////////////////
// static member function
//////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CCAssert(sm_pSharedApplication, "");
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
result r = E_SUCCESS;

View File

@ -57,8 +57,11 @@ public:
@brief Get current application instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/**
@brief Get current language config
@return Current language config

View File

@ -128,7 +128,7 @@ EGLView::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
{
return;
}
__pTimer->Start(Application::sharedApplication()->getAnimationInterval());
__pTimer->Start(Application::getInstance()->getAnimationInterval());
Director::getInstance()->mainLoop();
}

View File

@ -139,12 +139,12 @@ OspApplication::OnForeground(void)
if (timer != null)
{
timer->Start(cocos2d::Application::sharedApplication()->getAnimationInterval());
timer->Start(cocos2d::Application::getInstance()->getAnimationInterval());
}
if (Director::getInstance()->getOpenGLView())
{
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
}
@ -158,7 +158,7 @@ OspApplication::OnBackground(void)
timer->Cancel();
}
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
void

View File

@ -100,12 +100,18 @@ void Application::setAnimationInterval(double interval)
//////////////////////////////////////////////////////////////////////////
// static member function
//////////////////////////////////////////////////////////////////////////
Application* Application::sharedApplication()
Application* Application::getInstance()
{
CC_ASSERT(sm_pSharedApplication);
return sm_pSharedApplication;
}
// @deprecated Use getInstance() instead
Application* Application::sharedApplication()
{
return Application::getInstance();
}
ccLanguageType Application::getCurrentLanguage()
{
ccLanguageType ret = kLanguageEnglish;

View File

@ -25,8 +25,11 @@ public:
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static Application* sharedApplication();
static Application* getInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
/* override functions */
virtual void setAnimationInterval(double interval);
virtual ccLanguageType getCurrentLanguage();

View File

@ -444,10 +444,10 @@ LRESULT EGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
switch (wParam)
{
case SIZE_RESTORED:
Application::sharedApplication()->applicationWillEnterForeground();
Application::getInstance()->applicationWillEnterForeground();
break;
case SIZE_MINIMIZED:
Application::sharedApplication()->applicationDidEnterBackground();
Application::getInstance()->applicationDidEnterBackground();
break;
}
break;

View File

@ -26,5 +26,5 @@ int main(int argc, char **argv)
CCEGLView& eglView = CCEGLView::getInstance();
eglView.setSize(width, height);
return CCApplication::sharedApplication().run();
return CCApplication::getInstance().run();
}

View File

@ -30,7 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
else
{

View File

@ -30,7 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
else
{

View File

@ -225,7 +225,7 @@ void TestAnalytics::eventMenuCallback(Object* pSender)
void TestAnalytics::loadPlugins()
{
ccLanguageType langType = Application::sharedApplication()->getCurrentLanguage();
ccLanguageType langType = Application::getInstance()->getCurrentLanguage();
std::string umengKey = "";
std::string flurryKey = "";

View File

@ -29,7 +29,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -49,7 +49,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden:true];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -75,14 +75,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -26,7 +26,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -59,7 +59,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -84,14 +84,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -28,7 +28,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
eglView->setViewName("AssetsManagerTest");
eglView->setFrameSize(800, 450);
int ret = Application::sharedApplication()->run();
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -29,5 +29,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(width, height);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -15,5 +15,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -72,7 +72,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -97,14 +97,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -16,5 +16,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(800, 480);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -55,7 +55,7 @@ static AppDelegate s_sharedApplication;
[glView setFrameZoomFactor:0.4];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -15,5 +15,5 @@ int main()
{
AppDelegate app;
return cocos2d::Application::sharedApplication()->Run();
return cocos2d::Application::getInstance()->Run();
}

View File

@ -16,7 +16,7 @@ AppDelegate g_app;
void* cocos_main(void* arg)
{
fprintf(stderr, "in cocos_main\n");
int rtn = Application::sharedApplication()->run();
int rtn = Application::getInstance()->run();
fprintf(stderr, "app run returned: %d\n", rtn);
return NULL;
}

View File

@ -47,7 +47,7 @@ ApplicationInitialized(void)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(1280, 720);
Application::sharedApplication()->run();
Application::getInstance()->run();
}
//

View File

@ -20,5 +20,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
// The resolution of ipad3 is very large. In general, PC's resolution is smaller than it.
// So we need to invoke 'setFrameZoomFactor'(only valid on desktop(win32, mac, linux)) to make the window smaller.
eglView->setFrameZoomFactor(0.4f);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -29,5 +29,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(width, height);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -15,5 +15,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -72,7 +72,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -97,14 +97,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -16,5 +16,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(800, 480);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -55,7 +55,7 @@ static AppDelegate s_sharedApplication;
[glView setFrameZoomFactor:0.4];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -15,5 +15,5 @@ int main()
{
AppDelegate app;
return cocos2d::Application::sharedApplication()->Run();
return cocos2d::Application::getInstance()->Run();
}

View File

@ -20,7 +20,7 @@ void* cocos_main(void* arg)
CocosPepperInstance* instance = (CocosPepperInstance*)arg;
alSetPpapiInfo(instance->pp_instance(), pp::Module::Get()->get_browser_interface());
fprintf(stderr, "calling application->run\n");
int rtn = Application::sharedApplication()->run();
int rtn = Application::getInstance()->run();
fprintf(stderr, "app run returned: %d\n", rtn);
return NULL;
}

View File

@ -47,7 +47,7 @@ ApplicationInitialized(void)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(720, 1280);
Application::sharedApplication()->run();
Application::getInstance()->run();
}
//

View File

@ -9,7 +9,7 @@ CurrentLanguageTest::CurrentLanguageTest()
LabelTTF *labelLanguage = LabelTTF::create("", "Arial", 20);
labelLanguage->setPosition(VisibleRect::center());
ccLanguageType currentLanguageType = Application::sharedApplication()->getCurrentLanguage();
ccLanguageType currentLanguageType = Application::getInstance()->getCurrentLanguage();
switch (currentLanguageType)
{
case kLanguageEnglish:

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -26,5 +26,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(width, height);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -14,5 +14,5 @@ int main(int argc, char **argv)
// create the application instance
AppDelegate app;
EGLView* eglView = EGLView::getInstance();
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -59,7 +59,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden:true];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -85,14 +85,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -15,5 +15,5 @@ int main(int argc, char **argv)
AppDelegate app;
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(800, 480);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -62,7 +62,7 @@
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -15,5 +15,5 @@ int main()
{
AppDelegate app;
return cocos2d::Application::sharedApplication()->Run();
return cocos2d::Application::getInstance()->Run();
}

View File

@ -20,7 +20,7 @@ void* cocos_main(void* arg)
fprintf(stderr, "in cocos_main: %p\n", instance);
alSetPpapiInfo(instance->pp_instance(), pp::Module::Get()->get_browser_interface());
fprintf(stderr, "calling application->run\n");
int rtn = Application::sharedApplication()->run();
int rtn = Application::getInstance()->run();
fprintf(stderr, "app run returned: %d\n", rtn);
return NULL;
}

View File

@ -46,7 +46,7 @@ ApplicationInitialized(void)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(1280, 720);
Application::sharedApplication()->run();
Application::getInstance()->run();
}
//

View File

@ -17,5 +17,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
EGLView* eglView = EGLView::getInstance();
eglView->setViewName("TestCpp");
eglView->setFrameSize(480, 320);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -43,7 +43,7 @@ bool AppDelegate::applicationDidFinishLaunching()
std::vector<std::string> resDirOrders;
TargetPlatform platform = Application::sharedApplication()->getTargetPlatform();
TargetPlatform platform = Application::getInstance()->getTargetPlatform();
if (platform == kTargetIphone || platform == kTargetIpad || platform == kTargetMacOS)
{
std::vector<std::string> searchPaths = FileUtils::getInstance()->getSearchPaths();

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -56,7 +56,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -81,14 +81,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -62,7 +62,7 @@
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -28,7 +28,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
eglView->setViewName("CocosDragonJS");
eglView->setFrameSize(320, 480);
int ret = Application::sharedApplication()->run();
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();

View File

@ -40,7 +40,7 @@ bool AppDelegate::applicationDidFinishLaunching()
std::vector<std::string> searchPaths;
std::vector<std::string> resDirOrders;
TargetPlatform platform = Application::sharedApplication()->getTargetPlatform();
TargetPlatform platform = Application::getInstance()->getTargetPlatform();
if (platform == kTargetIphone || platform == kTargetIpad || platform == kTargetMacOS)
{
searchPaths.push_back("Published-iOS"); // Resources/Published-iOS

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -56,7 +56,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -81,14 +81,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -62,7 +62,7 @@
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -28,7 +28,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
eglView->setViewName("CrystalCraze");
eglView->setFrameSize(320, 480);
int ret = Application::sharedApplication()->run();
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -56,7 +56,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -81,14 +81,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -62,7 +62,7 @@
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -28,7 +28,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
eglView->setViewName("MoonWarriors");
eglView->setFrameSize(320, 480);
int ret = Application::sharedApplication()->run();
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -58,7 +58,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -83,14 +83,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -62,7 +62,7 @@
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -28,7 +28,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
eglView->setViewName("TestJavascript");
eglView->setFrameSize(800, 450);
int ret = Application::sharedApplication()->run();
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
/*
else

View File

@ -56,7 +56,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -81,14 +81,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -62,7 +62,7 @@
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -28,7 +28,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
eglView->setViewName("WatermelonWithMe");
eglView->setFrameSize(800, 450);
int ret = Application::sharedApplication()->run();
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();

View File

@ -27,7 +27,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
else
{

View File

@ -28,5 +28,5 @@ int main(int argc, char **argv)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(width, height);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -14,5 +14,5 @@ int main(int argc, char **argv)
AppDelegate app;
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(960, 640);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -72,7 +72,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
return YES;
}
@ -97,14 +97,14 @@ static AppDelegate s_sharedApplication;
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -14,5 +14,5 @@ int main(int argc, char **argv)
AppDelegate app;
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(960, 640);
return Application::sharedApplication()->run();
return Application::getInstance()->run();
}

View File

@ -53,7 +53,7 @@ static AppDelegate s_sharedApplication;
[window makeKeyAndOrderFront:self];
[window setAcceptsMouseMovedEvents:NO];
cocos2d::Application::sharedApplication()->run();
cocos2d::Application::getInstance()->run();
}
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication

View File

@ -15,5 +15,5 @@ int main()
{
AppDelegate app;
return cocos2d::Application::sharedApplication()->Run();
return cocos2d::Application::getInstance()->Run();
}

View File

@ -23,7 +23,7 @@ void* cocos_main(void* arg)
CocosPepperInstance* instance = (CocosPepperInstance*)arg;
alSetPpapiInfo(instance->pp_instance(), pp::Module::Get()->get_browser_interface());
fprintf(stderr, "calling application->run\n");
int rtn = Application::sharedApplication()->run();
int rtn = Application::getInstance()->run();
fprintf(stderr, "app run returned: %d\n", rtn);
return NULL;
}

View File

@ -46,7 +46,7 @@ ApplicationInitialized(void)
EGLView* eglView = EGLView::getInstance();
eglView->setFrameSize(1280, 720);
Application::sharedApplication()->run();
Application::getInstance()->run();
}
//

View File

@ -27,7 +27,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
EGLView* eglView = EGLView::getInstance();
eglView->setViewName("HelloLua");
eglView->setFrameSize(480, 320);
int ret = Application::sharedApplication()->run();
int ret = Application::getInstance()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();

View File

@ -7,7 +7,7 @@ local function CurrentLanguageTest()
local labelLanguage = CCLabelTTF:create("", "Arial", 20)
labelLanguage:setPosition(VisibleRect:center())
local currentLanguageType = CCApplication:sharedApplication():getCurrentLanguage()
local currentLanguageType = CCApplication:getInstance():getCurrentLanguage()
if currentLanguageType == kLanguageEnglish then
labelLanguage:setString("current language is English")

View File

@ -948,7 +948,7 @@ local function runEditBoxTest()
-- top
EditName = CCEditBox:create(editBoxSize, CCScale9Sprite:create("extensions/green_edit.png"))
EditName:setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4))
local targetPlatform = CCApplication:sharedApplication():getTargetPlatform()
local targetPlatform = CCApplication:getInstance():getTargetPlatform()
if kTargetIphone == targetPlatform or kTargetIpad == targetPlatform then
EditName:setFontName("Paint Boy")
else
@ -1104,7 +1104,7 @@ local function ExtensionsMainLayer()
menu:setPosition(CCPointMake(0, 0))
CCMenuItemFont:setFontName("Arial")
CCMenuItemFont:setFontSize(24)
local targetPlatform = CCApplication:sharedApplication():getTargetPlatform()
local targetPlatform = CCApplication:getInstance():getTargetPlatform()
local bSupportWebSocket = false
if (kTargetIphone == targetPlatform) or (kTargetIpad == targetPlatform) or (kTargetAndroid == targetPlatform) or (kTargetWindows == targetPlatform) then
bSupportWebSocket = true

View File

@ -28,7 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
Application::getInstance()->run();
}
else
{

Some files were not shown because too many files have changed in this diff Show More