Split into CC_BUILD_MACOS and CC_BUILD_IOS

This commit is contained in:
UnknownShadow200 2020-12-29 22:42:55 +11:00
parent aedd53eeb6
commit 2b17800a2c
3 changed files with 25 additions and 7 deletions

View File

@ -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

View File

@ -1075,7 +1075,9 @@ void Gfx_OnWindowResize(void) { Gfx_LoseContext(" (resizing window)"); }
#if defined CC_BUILD_WIN
#include <windows.h>
#include <GL/gl.h>
#elif defined CC_BUILD_DARWIN
#elif defined CC_BUILD_IOS
#include <OpenGLES/ES2/gl.h>
#elif defined CC_BUILD_MACOS
#include <OpenGL/gl.h>
#elif defined CC_BUILD_GLES
#include <GLES2/gl2.h>

View File

@ -65,7 +65,9 @@ const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
#if defined CC_BUILD_DARWIN
#include <mach/mach_time.h>
#include <mach-o/dyld.h>
#if defined CC_BUILD_MACOS
#include <ApplicationServices/ApplicationServices.h>
#endif
#elif defined CC_BUILD_SOLARIS
#include <sys/filio.h>
#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 };