Updated Makefile to support Android

This commit is contained in:
Ray 2017-10-22 11:12:10 +02:00
parent 33da9bc8f6
commit 3f9d76f227
12 changed files with 351 additions and 307 deletions

View file

@ -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
// Update and Draw
//----------------------------------------------------------------------------------
UpdateGame();
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
DrawGame();
UpdateDrawFrame();
//----------------------------------------------------------------------------------
}
#endif
@ -141,8 +148,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
return 0;
#endif
}
//--------------------------------------------------------------------------------------