diff options
Diffstat (limited to 'games/pang.c')
| -rw-r--r-- | games/pang.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/games/pang.c b/games/pang.c index fe1c3005..731234ae 100644 --- a/games/pang.c +++ b/games/pang.c @@ -15,6 +15,10 @@ #include <math.h> +#if defined(PLATFORM_ANDROID) + #include "android_native_app_glue.h" +#endif + #if defined(PLATFORM_WEB) #include <emscripten/emscripten.h> #endif @@ -106,9 +110,19 @@ static void UpdateDrawFrame(void); // Update and Draw (one frame) //------------------------------------------------------------------------------------ // Program main entry point //------------------------------------------------------------------------------------ -int main() +#if defined(PLATFORM_ANDROID) +void android_main(struct android_app *app) +#else +int main(void) +#endif { + // Initialization + //--------------------------------------------------------- +#if defined(PLATFORM_ANDROID) + InitWindow(screenWidth, screenHeight, app); +#else InitWindow(screenWidth, screenHeight, "sample game: pang"); +#endif InitGame(); @@ -122,14 +136,9 @@ int main() // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { - // Update + // Update and Draw //---------------------------------------------------------------------------------- - UpdateGame(); - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - DrawGame(); + UpdateDrawFrame(); //---------------------------------------------------------------------------------- } #endif @@ -140,8 +149,9 @@ int main() CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- - +#if !defined(PLATFORM_ANDROID) return 0; +#endif } //------------------------------------------------------------------------------------ |
