MCPcopy Create free account
hub / github.com/crownengine/crown / process_command

Method process_command

src/device/main_android.cpp:534–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532 }
533
534 void process_command(struct android_app *app, s32 cmd)
535 {
536 switch (cmd) {
537 case APP_CMD_SAVE_STATE:
538 break;
539
540 case APP_CMD_INIT_WINDOW: {
541 CE_ASSERT(app->window != NULL, "Android window is NULL");
542 _window = app->window;
543 init_pointer_capture_api();
544
545 // Push metrics here since Android does not trigger APP_CMD_WINDOW_RESIZED
546 const s32 width = ANativeWindow_getWidth(app->window);
547 const s32 height = ANativeWindow_getHeight(app->window);
548 _queue.push_resolution_event(width, height);
549
550 if (!_main_thread.is_running()) {
551 _main_thread.start([](void *user_data) {
552 return crown::main_runtime(*((DeviceOptions *)user_data));
553 }
554 , _opts
555 );
556 }
557 break;
558 }
559
560 case APP_CMD_TERM_WINDOW:
561 // The window is being hidden or closed, clean it up.
562 break;
563
564 case APP_CMD_WINDOW_RESIZED:
565 // Not triggered by Android
566 break;
567
568 case APP_CMD_GAINED_FOCUS:
569 break;
570
571 case APP_CMD_LOST_FOCUS:
572 break;
573
574 case APP_CMD_DESTROY:
575 _queue.push_exit_event();
576 break;
577 }
578 }
579
580#ifndef AMOTION_EVENT_AXIS_RELATIVE_X
581#define AMOTION_EVENT_AXIS_RELATIVE_X 27

Callers 1

on_app_cmdMethod · 0.80

Calls 3

main_runtimeFunction · 0.85
is_runningMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected