MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / applicationDidFinishLaunching

Method applicationDidFinishLaunching

Source/AppDelegate.cpp:122–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120
121
122bool AppDelegate::applicationDidFinishLaunching()
123{
124
125
126 // initialize director
127 auto director = Director::getInstance();
128 auto glView = director->getGLView();
129 if (!glView)
130 {
131#ifdef AX_PLATFORM_PC
132 glView = GLViewImpl::createWithRect(
133 "OpenGD", ax::Rect(0, 0, 1280, 720), 1.f, true);
134#else
135 glView = GLViewImpl::create("OpenGD");
136#endif
137
138#if (AX_TARGET_PLATFORM == AX_PLATFORM_LINUX)
139 int dispX;
140 int dispY;
141 auto disp = glfwGetPrimaryMonitor();
142 glfwGetMonitorPhysicalSize(disp, &dispX, &dispY);
143#endif
144
145#if FULLSCREEN == true
146 auto full = dynamic_cast<GLViewImpl *>(glView);
147 full->setFullscreen();
148#endif
149 director->setGLView(glView);
150 }
151
152 // display FPS stats or not.
153 director->setStatsDisplay(SHOW_FPS);
154
155 // set FPS. the default value is 1.0/60 if you don't call this
156 director->setAnimationInterval(1.0f / applicationGetRefreshRate());
157
158 setupDesignResolution(glView);
159
160#ifdef AX_PLATFORM_PC
161
162 glfwSetWindowAspectRatio(static_cast<GLViewImpl*>(glView)->getWindow(), 16, 9);
163
164 glfwSetWindowSizeCallback(static_cast<GLViewImpl*>(glView)->getWindow(), onGLFWwindowSizeCallback);
165
166#endif
167
168 GameToolbox::log("APLICATION INIT");
169 director->setContentScaleFactor(GameManager::getInstance()->isHigh() ? 4.0f : 2.0f);
170
171#if FULLSCREEN == true && AX_TARGET_PLATFORM == AX_PLATFORM_LINUX
172 std::cout << "X " << dispX << " Y " << dispY << std::endl;
173 glView->setFrameSize((float)dispX, (float)dispY);
174 // director->setAnimationInterval(1.0f / applicationGetRefreshRate());
175#endif
176
177 register_all_packages();
178
179 // create a scene. it's an autorelease object

Callers

nothing calls this directly

Calls 5

createFunction · 0.85
setupDesignResolutionFunction · 0.85
logFunction · 0.85
register_all_packagesFunction · 0.85
isHighMethod · 0.80

Tested by

no test coverage detected