MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / on_app_cmd

Function on_app_cmd

framework/platform/android/android_platform.cpp:281–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void on_app_cmd(android_app *app, int32_t cmd)
282{
283 auto platform = reinterpret_cast<AndroidPlatform *>(app->userData);
284 assert(platform && "Platform is not valid");
285
286 switch (cmd)
287 {
288 case APP_CMD_INIT_WINDOW:
289 {
290 platform->resize(ANativeWindow_getWidth(app->window),
291 ANativeWindow_getHeight(app->window));
292 platform->set_surface_ready();
293 break;
294 }
295 case APP_CMD_CONTENT_RECT_CHANGED:
296 {
297 // Get the new size
298 auto width = app->contentRect.right - app->contentRect.left;
299 auto height = app->contentRect.bottom - app->contentRect.top;
300 platform->resize(width, height);
301 break;
302 }
303 case APP_CMD_GAINED_FOCUS:
304 {
305 platform->set_focus(true);
306 break;
307 }
308 case APP_CMD_LOST_FOCUS:
309 {
310 platform->set_focus(false);
311 break;
312 }
313 }
314}
315
316bool key_event_filter(const GameActivityKeyEvent *event)
317{

Callers

nothing calls this directly

Calls 3

set_surface_readyMethod · 0.80
set_focusMethod · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected