summaryrefslogtreecommitdiffhomepage
path: root/games/arkanoid.c
diff options
context:
space:
mode:
Diffstat (limited to 'games/arkanoid.c')
-rw-r--r--games/arkanoid.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/games/arkanoid.c b/games/arkanoid.c
index 6231fb8b..1da80a1e 100644
--- a/games/arkanoid.c
+++ b/games/arkanoid.c
@@ -18,6 +18,10 @@
#include <time.h>
#include <math.h>
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
@@ -59,7 +63,6 @@ typedef struct Brick {
static int screenWidth = 800;
static int screenHeight = 450;
-static int framesCounter;
static bool gameOver;
static bool pause;
@@ -80,11 +83,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: arkanoid");
+#endif
InitGame();
@@ -98,14 +109,9 @@ int main()
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
- // Update
- //----------------------------------------------------------------------------------
- UpdateGame();
- //----------------------------------------------------------------------------------
-
- // Draw
+ // Update and Draw
//----------------------------------------------------------------------------------
- DrawGame();
+ UpdateDrawFrame();
//----------------------------------------------------------------------------------
}
#endif
@@ -116,8 +122,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//------------------------------------------------------------------------------------