MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / initWindow

Method initWindow

engine/source/platformAndroid/AndroidWindow.cpp:161–207  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

159
160//------------------------------------------------------------------------------
161void Platform::initWindow(const Point2I &initialSize, const char *name)
162{
163 S32 resolutionWidth = ANDROID_DEFAULT_RESOLUTION_X;
164 S32 resolutionHeight = ANDROID_DEFAULT_RESOLUTION_Y;
165
166 dSprintf(platState.appWindowTitle, sizeof(platState.appWindowTitle), name);
167
168 platState.windowSize.x = _AndroidGetScreenWidth();
169 platState.windowSize.y = _AndroidGetScreenHeight();
170
171 //Default to landscape, and run into portrait if requested.
172 S32 orientation = _AndroidGameGetOrientation();
173 if (orientation == ACONFIGURATION_ORIENTATION_PORT)
174 {
175 gScreenOrientation = 1;
176 platState.portrait = true;
177 }
178 else
179 {
180 gScreenOrientation = 0;
181 platState.portrait = false;
182 }
183
184 bool fullScreen;
185 U32 bpp = Con::getIntVariable("$pref::Android::ScreenDepth"); //ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH;
186 if (!bpp)
187 {
188 Con::printf("Default BPP Chosen , $pref::Android::ScreenDepth was not found.");
189 bpp = ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH;
190 }
191
192 fullScreen = true;
193 //
194 DisplayDevice::init();
195
196 // this will create a rendering context & window
197 bool ok = Video::setDevice("OpenGL", platState.windowSize.x, platState.windowSize.y, bpp, fullScreen);
198 if (!ok)
199 {
200 AssertFatal( false, "Could not find a compatible display device!" );
201 }
202
203 //Luma: Clear frame buffer to BLACK to start with
204 //NOTE: This should probably be set by the user to be the color closest to Default.png in order to minimize any popping effect... $pref:: anyone? Are $pref::s even valid at this point in the Init process?
205 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
206 glClear(GL_COLOR_BUFFER_BIT);
207}
208
209//--------------------------------------
210// run app function: not applicable to Android

Callers

nothing calls this directly

Calls 7

_AndroidGetScreenWidthFunction · 0.85
_AndroidGetScreenHeightFunction · 0.85
getIntVariableFunction · 0.85
printfFunction · 0.85
dSprintfFunction · 0.70
initFunction · 0.50

Tested by

no test coverage detected