gameplay-main-android.cpp 815 B

123456789101112131415161718192021222324252627282930313233
  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. assert(game != NULL);
  17. Platform* platform = Platform::create(game);
  18. assert(platform != NULL);
  19. platform->enterMessagePump();
  20. Game::getInstance()->exit();
  21. delete platform;
  22. // Android specific : the process needs to exit to
  23. // to trigger cleanup of global resources (such as game).
  24. exit(0);
  25. }
  26. #endif