MCPcopy Create free account
hub / github.com/axmolengine/axmol / applicationDidFinishLaunching

Method applicationDidFinishLaunching

tests/cpp-tests/Source/AppDelegate.cpp:60–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60bool AppDelegate::applicationDidFinishLaunching()
61{
62 // Enable logging output colored text style and prefix timestamp
63 ax::setLogFmtFlag(ax::LogFmtFlag::Full);
64
65 // whether enable global SDF font render support, since axmol-2.0.1
66 FontFreeType::setGlobalSDFEnabled(true);
67
68 // As an example, load config file
69 // FIXME:: This should be loaded before the Director is initialized,
70 // FIXME:: but at this point, the director is already initialized
71 Configuration::getInstance()->loadConfigFile("configs/config-example.plist");
72
73 // initialize director
74 auto director = Director::getInstance();
75 auto renderView = director->getRenderView();
76 if (!renderView)
77 {
78 std::string title = "Cpp Tests";
79#ifndef NDEBUG
80 title += " *Debug*",
81#endif
82#ifdef AX_PLATFORM_PC
83 renderView = RenderViewImpl::createWithRect(title, Rect(0, 0, g_resourceSize.width, g_resourceSize.height), 1.0F, true);
84#else
85 renderView = RenderViewImpl::createWithRect(title, Rect(0, 0, g_resourceSize.width, g_resourceSize.height));
86#endif
87 director->setRenderView(renderView);
88 }
89
90 director->setStatsDisplay(true);
91
92#ifdef AX_PLATFORM_PC
93 director->setAnimationInterval(1.0f / glfwGetVideoMode(glfwGetPrimaryMonitor())->refreshRate);
94#else
95 director->setAnimationInterval(1.0f / 60);
96#endif
97
98 auto screenSize = renderView->getFrameSize();
99
100 auto fileUtils = FileUtils::getInstance();
101 std::vector<std::string> searchPaths;
102
103 if (screenSize.height > 320)
104 {
105 searchPaths.emplace_back("hd");
106 searchPaths.emplace_back("ccs-res/hd");
107 searchPaths.emplace_back("ccs-res");
108 searchPaths.emplace_back("Manifests");
109 director->setContentScaleFactor(g_resourceSize.height / g_designSize.height);
110
111 searchPaths.emplace_back("hd/ActionTimeline");
112 }
113 else
114 {
115 searchPaths.emplace_back("ccs-res");
116
117 searchPaths.emplace_back("ActionTimeline");

Callers

nothing calls this directly

Calls 15

setLogFmtFlagFunction · 0.85
setGlobalSDFEnabledFunction · 0.85
getInstanceFunction · 0.85
glfwGetVideoModeFunction · 0.85
glfwGetPrimaryMonitorFunction · 0.85
getenvFunction · 0.85
loadConfigFileMethod · 0.80
setRenderViewMethod · 0.80
getFrameSizeMethod · 0.80
setContentScaleFactorMethod · 0.80
getSearchPathsMethod · 0.80
setSearchPathsMethod · 0.80

Tested by

no test coverage detected