From 2b17800a2c1a03b881d1f646af8e3a6fe9278c02 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 29 Dec 2020 22:42:55 +1100 Subject: [PATCH] Split into CC_BUILD_MACOS and CC_BUILD_IOS --- src/Core.h | 8 +++++++- src/Graphics.c | 4 +++- src/Platform.c | 20 +++++++++++++++----- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/Core.h b/src/Core.h index b44a9c789..eadac3fd7 100644 --- a/src/Core.h +++ b/src/Core.h @@ -182,10 +182,16 @@ Thus it is **NOT SAFE** to allocate a string on the stack. */ #define CC_BUILD_DARWIN #define CC_BUILD_POSIX #define CC_BUILD_GL -#ifdef __x86_64__ +#if defined __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ +#define CC_BUILD_GLES +#define CC_BUILD_GLMODERN +#define CC_BUILD_IOS +#elif defined __x86_64__ #define CC_BUILD_COCOA +#define CC_BUILD_MACOS #else #define CC_BUILD_CARBON +#define CC_BUILD_MACOS #endif #define CC_BUILD_CURL #define CC_BUILD_OPENAL diff --git a/src/Graphics.c b/src/Graphics.c index d5bcfda38..a223431d0 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -1075,7 +1075,9 @@ void Gfx_OnWindowResize(void) { Gfx_LoseContext(" (resizing window)"); } #if defined CC_BUILD_WIN #include #include -#elif defined CC_BUILD_DARWIN +#elif defined CC_BUILD_IOS +#include +#elif defined CC_BUILD_MACOS #include #elif defined CC_BUILD_GLES #include diff --git a/src/Platform.c b/src/Platform.c index 0c0315c79..e640e0825 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -65,7 +65,9 @@ const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; #if defined CC_BUILD_DARWIN #include #include +#if defined CC_BUILD_MACOS #include +#endif #elif defined CC_BUILD_SOLARIS #include #elif defined CC_BUILD_BSD @@ -1138,7 +1140,7 @@ cc_result Process_StartGame(const cc_string* args) { void Process_Exit(cc_result code) { exit(code); } /* Opening browser/starting shell is not really standardised */ -#if defined CC_BUILD_DARWIN +#if defined CC_BUILD_MACOS void Process_StartOpen(const cc_string* args) { UInt8 str[NATIVE_STR_LEN]; CFURLRef urlCF; @@ -1728,16 +1730,24 @@ static void Platform_InitStopwatch(void) { sw_freqDiv = (cc_uint64)tb.denom * 1000; } -void Platform_Init(void) { +#if defined CC_BUILD_MACOS +static void Platform_InitSpecific(void) { ProcessSerialNumber psn; /* TODO: kCurrentProcess */ - Platform_InitPosix(); - Platform_InitStopwatch(); - /* NOTE: Call as soon as possible, otherwise can't click on dialog boxes. */ GetCurrentProcess(&psn); /* NOTE: TransformProcessType is macOS 10.3 or later */ TransformProcessType(&psn, kProcessTransformToForegroundApplication); } +#else +/* Always foreground process on iOS */ +static void Platform_InitSpecific(void) { } +#endif + +void Platform_Init(void) { + Platform_InitPosix(); + Platform_InitStopwatch(); + Platform_InitSpecific(); +} #elif defined CC_BUILD_WEB void Platform_Init(void) { char tmp[64+1] = { 0 };