gameplay-main-android.cpp 760 B

12345678910111213141516171819202122232425262728293031
  1. #ifdef __ANDROID__
  2. #include <android_native_app_glue.h>
  3. #include "gameplay.h"
  4. using namespace gameplay;
  5. extern struct android_app* __state;
  6. /**
  7. * Main entry point.
  8. */
  9. void android_main(struct android_app* state)
  10. {
  11. // Android specific : Dummy function that needs to be called to
  12. // ensure that the native activity works properly behind the scenes.
  13. app_dummy();
  14. __state = state;
  15. Game* game = Game::getInstance();
  16. Platform* platform = Platform::create(game);
  17. GP_ASSERT(platform);
  18. platform->enterMessagePump();
  19. delete platform;
  20. // Android specific : the process needs to exit to trigger
  21. // cleanup of global and static resources (such as the game).
  22. exit(0);
  23. }
  24. #endif