| 5032 | static int32_t processInput(struct android_app *app, AInputEvent *event) { return 0; } |
| 5033 | |
| 5034 | static void processCommand(struct android_app *app, int32_t cmd) { |
| 5035 | switch (cmd) { |
| 5036 | case APP_CMD_INIT_WINDOW: { |
| 5037 | if (app->window) { |
| 5038 | // We're getting a new window. If the app is starting up, we |
| 5039 | // need to initialize. If the app has already been |
| 5040 | // initialized, that means that we lost our previous window, |
| 5041 | // which means that we have a lot of work to do. At a minimum, |
| 5042 | // we need to destroy the swapchain and surface associated with |
| 5043 | // the old window, and create a new surface and swapchain. |
| 5044 | // However, since there are a lot of other objects/state that |
| 5045 | // is tied to the swapchain, it's easiest to simply cleanup and |
| 5046 | // start over (i.e. use a brute-force approach of re-starting |
| 5047 | // the app) |
| 5048 | if (demo.initialized) { |
| 5049 | demo_cleanup(&demo); |
| 5050 | } |
| 5051 | |
| 5052 | // Parse Intents into argc, argv |
| 5053 | // Use the following key to send arguments, i.e. |
| 5054 | // --es args "--validate" |
| 5055 | const char key[] = "args"; |
| 5056 | char *appTag = (char *)APP_SHORT_NAME; |
| 5057 | int argc = 0; |
| 5058 | char **argv = get_args(app, key, appTag, &argc); |
| 5059 | |
| 5060 | __android_log_print(ANDROID_LOG_INFO, appTag, "argc = %i", argc); |
| 5061 | for (int i = 0; i < argc; i++) __android_log_print(ANDROID_LOG_INFO, appTag, "argv[%i] = %s", i, argv[i]); |
| 5062 | |
| 5063 | demo_init(&demo, argc, argv); |
| 5064 | |
| 5065 | // Free the argv malloc'd by get_args |
| 5066 | for (int i = 0; i < argc; i++) free(argv[i]); |
| 5067 | |
| 5068 | demo.window = (void *)app->window; |
| 5069 | demo_create_surface(&demo); |
| 5070 | demo_select_physical_device(&demo); |
| 5071 | demo_init_vk_swapchain(&demo); |
| 5072 | demo_prepare(&demo); |
| 5073 | } |
| 5074 | break; |
| 5075 | } |
| 5076 | case APP_CMD_GAINED_FOCUS: { |
| 5077 | active = true; |
| 5078 | break; |
| 5079 | } |
| 5080 | case APP_CMD_LOST_FOCUS: { |
| 5081 | active = false; |
| 5082 | break; |
| 5083 | } |
| 5084 | } |
| 5085 | } |
| 5086 | |
| 5087 | void android_main(struct android_app *app) { |
| 5088 | demo.initialized = false; |
nothing calls this directly
no test coverage detected