summaryrefslogtreecommitdiffhomepage
path: root/games/asteroids.c
diff options
context:
space:
mode:
authorRay <[email protected]>2017-10-22 11:12:10 +0200
committerRay <[email protected]>2017-10-22 11:12:10 +0200
commit3f9d76f227f166d339b1c4b5dd507e2491e9b967 (patch)
treef055a8ae252ec7b08028d8cf5d65eaacc8e88206 /games/asteroids.c
parent33da9bc8f609d904da48161d98e5df527a86ff60 (diff)
downloadraylib-3f9d76f227f166d339b1c4b5dd507e2491e9b967.tar.gz
raylib-3f9d76f227f166d339b1c4b5dd507e2491e9b967.zip
Updated Makefile to support Android
Diffstat (limited to 'games/asteroids.c')
-rw-r--r--games/asteroids.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/games/asteroids.c b/games/asteroids.c
index 11063889..dc8a9e07 100644
--- a/games/asteroids.c
+++ b/games/asteroids.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
@@ -68,7 +72,6 @@ typedef struct Meteor {
static int screenWidth = 800;
static int screenHeight = 450;
-static int framesCounter;
static bool gameOver;
static bool pause;
static bool victory;
@@ -95,16 +98,22 @@ static void DrawGame(void); // Draw game (one frame)
static void UnloadGame(void); // Unload game
static void UpdateDrawFrame(void); // Update and Draw (one frame)
-static void DrawSpaceship(Vector2 position, float rotation, Color color);
-
//------------------------------------------------------------------------------------
// 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: asteroids");
+#endif
InitGame();
@@ -118,14 +127,9 @@ int main()
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
- // Update
- //----------------------------------------------------------------------------------
- UpdateGame();
- //----------------------------------------------------------------------------------
-
- // Draw
+ // Update and Draw
//----------------------------------------------------------------------------------
- DrawGame();
+ UpdateDrawFrame();
//----------------------------------------------------------------------------------
}
#endif
@@ -136,8 +140,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//------------------------------------------------------------------------------------