mirror of https://github.com/axmolengine/axmol.git
commit
1116176362
|
@ -8,26 +8,25 @@ static cocos2d::Size smallResolutionSize = cocos2d::Size(480, 320);
|
|||
static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024, 768);
|
||||
static cocos2d::Size largeResolutionSize = cocos2d::Size(2048, 1536);
|
||||
|
||||
AppDelegate::AppDelegate() {
|
||||
|
||||
AppDelegate::AppDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
//if you want a different context,just modify the value of glContextAttrs
|
||||
//it will takes effect on all platforms
|
||||
// if you want a different context, modify the value of glContextAttrs
|
||||
// it will affect all platforms
|
||||
void AppDelegate::initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
}
|
||||
|
||||
// If you want to use packages manager to install more packages,
|
||||
// if you want to use the package manager to install more packages,
|
||||
// don't modify or remove this function
|
||||
static int register_all_packages()
|
||||
{
|
||||
|
@ -83,11 +82,11 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground() {
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
||||
// if you use SimpleAudioEngine, it must be pause
|
||||
// if you use SimpleAudioEngine, it must be paused
|
||||
// SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -24,13 +24,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -162,7 +162,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -31,13 +31,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -30,12 +30,11 @@ AppDelegate::~AppDelegate()
|
|||
#endif
|
||||
}
|
||||
|
||||
//if you want a different context,just modify the value of glContextAttrs
|
||||
//it will takes effect on all platforms
|
||||
// if you want a different context, modify the value of glContextAttrs
|
||||
// it will affect all platforms
|
||||
void AppDelegate::initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
|
@ -83,7 +82,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -31,13 +31,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -33,18 +33,17 @@ AppDelegate::~AppDelegate()
|
|||
|
||||
}
|
||||
|
||||
//if you want a different context,just modify the value of glContextAttrs
|
||||
//it will takes effect on all platforms
|
||||
// if you want a different context, modify the value of glContextAttrs
|
||||
// it will affect all platforms
|
||||
void AppDelegate::initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
}
|
||||
|
||||
// If you want to use packages manager to install more packages,
|
||||
// if you want to use the package manager to install more packages,
|
||||
// don't modify or remove this function
|
||||
static int register_all_packages()
|
||||
{
|
||||
|
@ -86,7 +85,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -24,13 +24,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -100,8 +100,7 @@ std::string getCurAppPath(void)
|
|||
|
||||
static void initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
|
|
|
@ -27,7 +27,8 @@ void AppDelegate::initGLContextAttrs()
|
|||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching() {
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// initialize director
|
||||
auto director = Director::getInstance();
|
||||
auto glview = director->getOpenGLView();
|
||||
|
@ -106,11 +107,12 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground() {
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
||||
// if you use SimpleAudioEngine, it must be pause
|
||||
// if you use SimpleAudioEngine, it must be paused
|
||||
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -24,13 +24,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -43,12 +43,11 @@ AppDelegate::~AppDelegate()
|
|||
cocostudio::ArmatureDataManager::destroyInstance();
|
||||
}
|
||||
|
||||
//if you want a different context,just modify the value of glContextAttrs
|
||||
//it will takes effect on all platforms
|
||||
// if you want a different context, modify the value of glContextAttrs
|
||||
// it will affect all platforms
|
||||
void AppDelegate::initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
|
@ -109,7 +108,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
if (_testController)
|
||||
|
|
|
@ -32,7 +32,7 @@ class TestController;
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -50,13 +50,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -17,7 +17,8 @@ AppDelegate::~AppDelegate()
|
|||
{
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching() {
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
auto glview = director->getOpenGLView();
|
||||
if(!glview) {
|
||||
|
@ -64,8 +65,9 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground() {
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -22,13 +22,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -164,7 +164,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -23,13 +23,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching() override;
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground() override;
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground() override;
|
||||
|
|
|
@ -165,7 +165,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -23,13 +23,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching() override;
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground() override;
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground() override;
|
||||
|
|
|
@ -42,7 +42,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -23,13 +23,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -43,7 +43,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -22,13 +22,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -56,7 +56,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -23,13 +23,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -16,25 +16,25 @@ AppDelegate::~AppDelegate()
|
|||
{
|
||||
}
|
||||
|
||||
//if you want a different context,just modify the value of glContextAttrs
|
||||
//it will takes effect on all platforms
|
||||
// if you want a different context, modify the value of glContextAttrs
|
||||
// it will affect all platforms
|
||||
void AppDelegate::initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
}
|
||||
|
||||
// If you want to use packages manager to install more packages,
|
||||
// if you want to use the package manager to install more packages,
|
||||
// don't modify or remove this function
|
||||
static int register_all_packages()
|
||||
{
|
||||
return 0; //flag for packages manager
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching() {
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// initialize director
|
||||
auto director = Director::getInstance();
|
||||
auto glview = director->getOpenGLView();
|
||||
|
@ -79,11 +79,12 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground() {
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
||||
// if you use SimpleAudioEngine, it must be pause
|
||||
// if you use SimpleAudioEngine, it must be paused
|
||||
// SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -24,13 +24,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -30,12 +30,11 @@ AppDelegate::~AppDelegate()
|
|||
RuntimeEngine::getInstance()->end();
|
||||
}
|
||||
|
||||
//if you want a different context,just modify the value of glContextAttrs
|
||||
//it will takes effect on all platforms
|
||||
// if you want a different context, modify the value of glContextAttrs
|
||||
// it will affect all platforms
|
||||
void AppDelegate::initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
|
@ -65,7 +64,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
Private inheritance here hides part of interface from Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
|
@ -24,13 +24,13 @@ public:
|
|||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@brief Called when the application moves to the background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@brief Called when the application reenters the foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
|
|
@ -116,8 +116,7 @@ static bool stringEndWith(const std::string str, const std::string needle)
|
|||
|
||||
static void initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
|
|
|
@ -88,8 +88,7 @@ std::string getCurAppPath(void)
|
|||
|
||||
static void initGLContextAttrs()
|
||||
{
|
||||
//set OpenGL context attributions,now can only set six attributions:
|
||||
//red,green,blue,alpha,depth,stencil
|
||||
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
|
||||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
|
||||
|
||||
GLView::setGLContextAttrs(glContextAttrs);
|
||||
|
|
Loading…
Reference in New Issue