summaryrefslogtreecommitdiffhomepage
path: root/games/tetris.c
diff options
context:
space:
mode:
authorRay <[email protected]>2017-10-22 20:43:57 +0200
committerGitHub <[email protected]>2017-10-22 20:43:57 +0200
commit8380c488be90ed0c29a6446b490bfaca6574436e (patch)
tree04e6dac350ecb354600b1019cc98fdbce03198c1 /games/tetris.c
parent18601f761935cd81b0f6298e22885c9bc6b5ee6e (diff)
parent2ba43b595ec1129bd08b89104d5e0fa962d5b2b8 (diff)
downloadraylib-1.8.0.tar.gz
raylib-1.8.0.zip
Merge pull request #371 from raysan5/develop1.8.0
Integrate Develop branch
Diffstat (limited to 'games/tetris.c')
-rw-r--r--games/tetris.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/games/tetris.c b/games/tetris.c
index 84ba9196..e02d7f18 100644
--- a/games/tetris.c
+++ b/games/tetris.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
@@ -105,11 +109,19 @@ static void DeleteCompleteLines();
//------------------------------------------------------------------------------------
// 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: tetris");
+#endif
InitGame();
@@ -123,14 +135,9 @@ int main()
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
- // Update
- //----------------------------------------------------------------------------------
- UpdateGame();
- //----------------------------------------------------------------------------------
-
- // Draw
+ // Update and Draw
//----------------------------------------------------------------------------------
- DrawGame();
+ UpdateDrawFrame();
//----------------------------------------------------------------------------------
}
#endif
@@ -141,8 +148,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//--------------------------------------------------------------------------------------