31#include "extensions/cocos-ext.h"
36: _testController(nullptr)
52 GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8, 0};
54 GLView::setGLContextAttrs(glContextAttrs);
62 Configuration::getInstance()->loadConfigFile(
"configs/config-example.plist");
65 auto director = Director::getInstance();
66 auto glview = director->getOpenGLView();
68 glview = GLViewImpl::create(
"Cpp Tests");
69 director->setOpenGLView(glview);
72 director->setDisplayStats(
true);
73 director->setAnimationInterval(1.0f / 60);
75 auto screenSize = glview->getFrameSize();
76 auto designSize = Size(480, 320);
78 auto fileUtils = FileUtils::getInstance();
79 std::vector<std::string> searchPaths;
81 if (screenSize.height > 320)
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);
90 searchPaths.push_back(
"hd/ActionTimeline");
94 searchPaths.push_back(
"ccs-res");
96 searchPaths.push_back(
"ActionTimeline");
99 fileUtils->setSearchPaths(searchPaths);
101 glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER);
104 auto console = director->getConsole();
105 console->listenOnTCP(5678);
120 Director::getInstance()->stopAnimation();
131 Director::getInstance()->startAnimation();
virtual void applicationDidEnterBackground()
Called when the application moves to the background
virtual void initGLContextAttrs()
TestController * _testController
virtual bool applicationDidFinishLaunching()
Implement Director and cocos2d::Scene* init code here.
virtual void applicationWillEnterForeground()
Called when the application reenters the foreground
static TestController * getInstance()