MCPcopy Create free account
hub / github.com/defold/defold / WaitForWindow

Function WaitForWindow

engine/hid/src/test/test_app_hid.cpp:293–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291
292#if defined(ANDROID)
293static bool WaitForWindow()
294{
295 while (glfwAndroidWindowOpened() == 0)
296 {
297 void* data = 0;
298 int ident = ALooper_pollOnce(300, 0, 0, &data);
299
300 android_app* app = dmAndroid::GetAndroidApp();
301 if (app == 0)
302 {
303 dmLogFatal("Android app handle is unavailable while waiting for the window.");
304 return false;
305 }
306
307 if (ident >= 0 && data != 0)
308 {
309 android_poll_source* source = (android_poll_source*)data;
310 source->process(app, source);
311 }
312 if (ident == ALOOPER_POLL_ERROR)
313 {
314 dmLogFatal("ALooper_pollOnce returned an error");
315 return false;
316 }
317
318 glfwAndroidFlushEvents();
319 if (app->destroyRequested)
320 {
321 return false;
322 }
323 dmTime::Sleep(300);
324 }
325 return true;
326}
327#endif
328
329static void EngineDestroy(void* _engine)

Callers 1

EngineCreateFunction · 0.70

Calls 5

glfwAndroidWindowOpenedFunction · 0.85
glfwAndroidFlushEventsFunction · 0.85
GetAndroidAppFunction · 0.50
SleepFunction · 0.50
processMethod · 0.45

Tested by

no test coverage detected