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

Function android_main

Source/TestRenderer/AndroidMain.cpp:372–413  ·  view source on GitHub ↗

* This is the main entry point of a native application that is using * android_native_app_glue. It runs in its own thread, with its own * event loop for receiving input events and doing other things. */

Source from the content-addressed store, hash-verified

370 * event loop for receiving input events and doing other things.
371 */
372void android_main(android_app *appState) {
373 InitInstance(appState);
374
375 // loop waiting for stuff to do.
376 while (1) {
377 // Read all pending events.
378 int id;
379 int events;
380 android_poll_source *source;
381
382 // If not animating, we will block forever waiting for events.
383 // If animating, we loop until all events are read, then continue
384 // to draw the next frame of animation.
385 while ((id = ALooper_pollAll(!suspended ? 0 : -1, nullptr, &events, (void **)&source)) >= 0) {
386 // Process this event.
387 if (source) {
388 source->process(appState, source);
389 }
390
391 ProcessSensors(id);
392
393 // Check if we are exiting.
394 if (appState->destroyRequested != 0) {
395 ShutdownInstance();
396 return;
397 }
398 }
399
400 if (surfaceCreated && !suspended) {
401 BE1::RHI::DisplayMetrics displayMetrics;
402 BE1::rhi.GetDisplayMetrics(mainContext, &displayMetrics);
403
404 if (displayMetrics.backingWidth != currentWindowWidth || displayMetrics.backingHeight != currentWindowHeight) {
405 WindowSizeChanged(displayMetrics.backingWidth, displayMetrics.backingHeight);
406 }
407
408 app.RunFrame();
409
410 BE1::rhi.DisplayContext(mainContext);
411 }
412 }
413}

Callers 1

android_app_entryFunction · 0.70

Calls 8

InitInstanceFunction · 0.70
ProcessSensorsFunction · 0.70
ShutdownInstanceFunction · 0.70
WindowSizeChangedFunction · 0.70
processMethod · 0.45
GetDisplayMetricsMethod · 0.45
RunFrameMethod · 0.45
DisplayContextMethod · 0.45

Tested by

no test coverage detected