2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00
Files
raylib-cs/android.patch
2023-07-22 16:55:25 +07:00

25 lines
779 B
Diff

diff --git a/src/rcore.c b/src/rcore.c
index eae4951..76e26ad 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -709,7 +709,18 @@ const char *TextFormat(const char *text, ...); // Formatting of text with
#if defined(PLATFORM_ANDROID)
// To allow easier porting to android, we allow the user to define a
// main function which we call from android_main, defined by ourselves
-extern int main(int argc, char *argv[]);
+
+typedef void (*RaylibAndroidCallback)();
+static RaylibAndroidCallback _androidCallback = NULL;
+
+void RaylibSetAndroidCallback(RaylibAndroidCallback callback) {
+ _androidCallback = callback;
+}
+
+int main(int argc, char *argv[]) {
+ while(_androidCallback == NULL) {}
+ _androidCallback();
+}
void android_main(struct android_app *app)
{