PuzzleSDK
AppDelegate类 参考

The cocos2d Application. 更多...

#include <AppDelegate.h>

+ 类 AppDelegate 继承关系图:
+ AppDelegate 的协作图:

Public 成员函数

 AppDelegate ()
 
virtual ~AppDelegate ()
 
virtual void initGLContextAttrs ()
 
virtual bool applicationDidFinishLaunching ()
 Implement Director and cocos2d::Scene* init code here. 更多...
 
virtual void applicationDidEnterBackground ()
 Called when the application moves to the background 更多...
 
virtual void applicationWillEnterForeground ()
 Called when the application reenters the foreground 更多...
 

Private 属性

TestController_testController
 

详细描述

The cocos2d Application.

Private inheritance here hides part of interface from Director.

在文件 AppDelegate.h38 行定义.

构造及析构函数说明

◆ AppDelegate()

AppDelegate::AppDelegate ( )

在文件 AppDelegate.cpp35 行定义.

36: _testController(nullptr)
37{
38}
TestController * _testController
Definition: AppDelegate.h:66

◆ ~AppDelegate()

AppDelegate::~AppDelegate ( )
virtual

在文件 AppDelegate.cpp40 行定义.

41{
42 //SimpleAudioEngine::end();
43 //TODO: minggo
44 // cocostudio::ArmatureDataManager::destroyInstance();
45}

成员函数说明

◆ applicationDidEnterBackground()

void AppDelegate::applicationDidEnterBackground ( )
virtual

Called when the application moves to the background

参数
thepointer of the application

在文件 AppDelegate.cpp113 行定义.

114{
115 if (_testController)
116 {
117// _testController->onEnterBackground();
118 }
119
120 Director::getInstance()->stopAnimation();
121}

引用了 _testController.

◆ applicationDidFinishLaunching()

bool AppDelegate::applicationDidFinishLaunching ( )
virtual

Implement Director and cocos2d::Scene* init code here.

返回
true Initialize success, app continue.
false Initialize failed, app terminate.

在文件 AppDelegate.cpp57 行定义.

58{
59 // As an example, load config file
60 // FIXME:: This should be loaded before the Director is initialized,
61 // FIXME:: but at this point, the director is already initialized
62 Configuration::getInstance()->loadConfigFile("configs/config-example.plist");
63
64 // initialize director
65 auto director = Director::getInstance();
66 auto glview = director->getOpenGLView();
67 if(!glview) {
68 glview = GLViewImpl::create("Cpp Tests");
69 director->setOpenGLView(glview);
70 }
71
72 director->setDisplayStats(true);
73 director->setAnimationInterval(1.0f / 60);
74
75 auto screenSize = glview->getFrameSize();
76 auto designSize = Size(480, 320);
77
78 auto fileUtils = FileUtils::getInstance();
79 std::vector<std::string> searchPaths;
80
81 if (screenSize.height > 320)
82 {
83 auto resourceSize = Size(960, 640);
84 searchPaths.push_back("hd");
85 searchPaths.push_back("ccs-res/hd");
86 searchPaths.push_back("ccs-res");
87 searchPaths.push_back("Manifests");
88 director->setContentScaleFactor(resourceSize.height/designSize.height);
89
90 searchPaths.push_back("hd/ActionTimeline");
91 }
92 else
93 {
94 searchPaths.push_back("ccs-res");
95
96 searchPaths.push_back("ActionTimeline");
97 }
98
99 fileUtils->setSearchPaths(searchPaths);
100
101 glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER);
102
103 // Enable Remote Console
104 auto console = director->getConsole();
105 console->listenOnTCP(5678);
106
108
109 return true;
110}
static TestController * getInstance()
Definition: controller.cpp:458

引用了 _testController , 以及 TestController::getInstance().

+ 函数调用图:

◆ applicationWillEnterForeground()

void AppDelegate::applicationWillEnterForeground ( )
virtual

Called when the application reenters the foreground

参数
thepointer of the application

在文件 AppDelegate.cpp124 行定义.

125{
126 if (_testController)
127 {
128// _testController->onEnterForeground();
129 }
130
131 Director::getInstance()->startAnimation();
132}

引用了 _testController.

◆ initGLContextAttrs()

void AppDelegate::initGLContextAttrs ( )
virtual

在文件 AppDelegate.cpp49 行定义.

50{
51 // set OpenGL context attributes: red,green,blue,alpha,depth,stencil
52 GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8, 0};
53
54 GLView::setGLContextAttrs(glContextAttrs);
55}

类成员变量说明

◆ _testController

TestController* AppDelegate::_testController
private

该类的文档由以下文件生成: