From 3f9d76f227f166d339b1c4b5dd507e2491e9b967 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 22 Oct 2017 11:12:10 +0200 Subject: Updated Makefile to support Android --- games/gold_fever.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'games/gold_fever.c') diff --git a/games/gold_fever.c b/games/gold_fever.c index 5a435027..1d8b6b7c 100644 --- a/games/gold_fever.c +++ b/games/gold_fever.c @@ -13,6 +13,10 @@ #include "raylib.h" +#if defined(PLATFORM_ANDROID) + #include "android_native_app_glue.h" +#endif + #if defined(PLATFORM_WEB) #include #endif @@ -54,7 +58,6 @@ typedef struct Home { static int screenWidth = 800; static int screenHeight = 450; -static int framesCounter; static bool gameOver; static bool pause; static int score; @@ -78,12 +81,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: gold fever"); +#endif InitGame(); @@ -97,14 +107,9 @@ int main() // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { - // Update - //---------------------------------------------------------------------------------- - UpdateGame(); - //---------------------------------------------------------------------------------- - - // Draw + // Update and Draw //---------------------------------------------------------------------------------- - DrawGame(); + UpdateDrawFrame(); //---------------------------------------------------------------------------------- } #endif @@ -115,8 +120,9 @@ int main() CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- - +#if !defined(PLATFORM_ANDROID) return 0; +#endif } //------------------------------------------------------------------------------------ -- cgit v1.2.3