| 279 | } |
| 280 | |
| 281 | void 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 | |
| 316 | bool key_event_filter(const GameActivityKeyEvent *event) |
| 317 | { |
nothing calls this directly
no test coverage detected