Allow use of main instead of android_main
Inspired by #504. Instead of requiring the user to do PLATFORM_ANDROID #ifdefery, have the android_main entry point exported by raylib and call the user-defined main. This way many games could (in theory) run unmodified on Android and elsewhere. This is untested!
This commit is contained in:
parent
61e0e4b4f3
commit
2c219fb814
21 changed files with 77 additions and 315 deletions
|
@ -18,10 +18,6 @@
|
|||
#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
|
||||
|
@ -109,19 +105,11 @@ static void DeleteCompleteLines();
|
|||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
void android_main(struct android_app *app)
|
||||
#else
|
||||
int main(void)
|
||||
#endif
|
||||
{
|
||||
// Initialization
|
||||
// Initialization (Note windowTitle is unused on Android)
|
||||
//---------------------------------------------------------
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
InitWindow(screenWidth, screenHeight, app);
|
||||
#else
|
||||
InitWindow(screenWidth, screenHeight, "sample game: tetris");
|
||||
#endif
|
||||
|
||||
InitGame();
|
||||
|
||||
|
@ -148,9 +136,8 @@ int main(void)
|
|||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
#if !defined(PLATFORM_ANDROID)
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -841,4 +828,4 @@ static void DeleteCompleteLines()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue