MCPcopy Create free account
hub / github.com/SatDump/SatDump / android_main

Function android_main

android/main.cpp:266–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void android_main(struct android_app *app)
267{
268 g_App = app;
269 bindImageTextureFunctions();
270 bindBackendFunctions();
271
272 std::string path = getAppFilesDir(app);
273 android_plugins_dir = getPluginsDir(app);
274 chdir(path.c_str());
275
276 app->onAppCmd = handleAppCmd;
277 app->onInputEvent = handleInputEvent;
278
279 while (true)
280 {
281 int out_events;
282 struct android_poll_source *out_data;
283
284 // Poll all events. If the app is not visible, this loop blocks until g_Initialized == true.
285 while (ALooper_pollAll(g_Initialized ? 0 : -1, NULL, &out_events, (void **)&out_data) >= 0)
286 {
287 // Process one event
288 if (out_data != NULL)
289 out_data->process(app, out_data);
290
291 // Exit the app by returning from within the infinite loop
292 if (app->destroyRequested != 0)
293 {
294 // shutdown() should have been called already while processing the
295 // app command APP_CMD_TERM_WINDOW. But we play save here
296 if (!g_Initialized)
297 shutdown();
298
299 return;
300 }
301 }
302
303 // Initiate a new frame
304 tick();
305 }
306}
307
308// Unfortunately, there is no way to show the on-screen input from native code.
309// Therefore, we call ShowSoftKeyboardInput() of the main activity implemented in MainActivity.kt via JNI.

Callers

nothing calls this directly

Calls 8

getAppFilesDirFunction · 0.85
getPluginsDirFunction · 0.85
shutdownFunction · 0.85
tickFunction · 0.85
c_strMethod · 0.80
bindBackendFunctionsFunction · 0.70
processMethod · 0.45

Tested by

no test coverage detected