gameplay-main-android.cpp 759 B

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