MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / InitDisplay

Function InitDisplay

Source/Player/AndroidMain.cpp:150–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150static void InitDisplay(ANativeWindow *window) {
151 if (appInitialized) {
152 BE1::rhi.ActivateSurface(app.mainRenderContext->GetContextHandle(), window);
153 return;
154 }
155
156 appInitialized = true;
157
158 BE1::renderSystem.InitRHI(window);
159
160 RenderQuality::Enum renderQuality = DetermineRenderQuality();
161
162 const char *configName = "";
163 if (renderQuality == RenderQuality::High) {
164 configName = "highQuality";
165 } else if (renderQuality == RenderQuality::Medium) {
166 configName = "mediumQuality";
167 } else {
168 configName = "lowQuality";
169 }
170 BE1::cmdSystem.BufferCommandText(BE1::CmdSystem::Execution::Now, BE1::va("exec \"Config/%s.cfg\"\n", configName));
171 BE1::cvarSystem.ClearModified();
172
173 // Get window width/height in pixels.
174 currentWindowWidth = ANativeWindow_getWidth(window);
175 currentWindowHeight = ANativeWindow_getHeight(window);
176
177 int renderWidth;
178 int renderHeight;
179
180 if (currentWindowWidth > currentWindowHeight) {
181 // landscape mode
182 if (renderQuality == RenderQuality::High) {
183 renderWidth = BE1::Min(1920, currentWindowWidth);
184 renderHeight = BE1::Min(1080, currentWindowHeight);
185 } else if (renderQuality == RenderQuality::Medium) {
186 renderWidth = BE1::Min(1280, currentWindowWidth);
187 renderHeight = BE1::Min(720, currentWindowHeight);
188 } else {
189 renderWidth = BE1::Min(1024, currentWindowWidth);
190 renderHeight = BE1::Min(576, currentWindowHeight);
191 }
192 } else {
193 if (renderQuality == RenderQuality::High) {
194 renderWidth = BE1::Min(1080, currentWindowWidth);
195 renderHeight = BE1::Min(1920, currentWindowHeight);
196 } else if (renderQuality == RenderQuality::Medium) {
197 renderWidth = BE1::Min(720, currentWindowWidth);
198 renderHeight = BE1::Min(1280, currentWindowHeight);
199 } else {
200 renderWidth = BE1::Min(576, currentWindowWidth);
201 renderHeight = BE1::Min(1024, currentWindowHeight);
202 }
203 }
204
205 BE1::gameClient.Init(window, false);
206
207 app.mainRenderContext = BE1::renderSystem.AllocRenderContext(true);

Callers 1

HandleCmdFunction · 0.70

Calls 15

DetermineRenderQualityFunction · 0.85
vaFunction · 0.85
GetContextHandleMethod · 0.80
InitRHIMethod · 0.80
BufferCommandTextMethod · 0.80
ClearModifiedMethod · 0.80
AllocRenderContextMethod · 0.80
OnResizeMethod · 0.80
StateMethod · 0.80
LoadAppScriptMethod · 0.80
StartAppScriptMethod · 0.80
MinFunction · 0.50

Tested by

no test coverage detected