diff --git a/src/Window_SDL.c b/src/Window_SDL.c index a760cb04a..ee0dfe88d 100644 --- a/src/Window_SDL.c +++ b/src/Window_SDL.c @@ -77,8 +77,9 @@ static void DoCreateWindow(int width, int height, int flags) { Window_Main.Handle = win_handle; /* TODO grab using SDL_SetWindowGrab? seems to be unnecessary on Linux at least */ } + void Window_Create2D(int width, int height) { DoCreateWindow(width, height, 0); } -#if !defined CC_BUILD_SOFTGPU +#if CC_GFX_BACKEND == CC_GFX_BACKEND_GL void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_WINDOW_OPENGL); } #else void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); } diff --git a/src/Window_SDL3.c b/src/Window_SDL3.c index 44131c6a1..2bc6493ff 100644 --- a/src/Window_SDL3.c +++ b/src/Window_SDL3.c @@ -61,8 +61,13 @@ static void DoCreateWindow(int width, int height, int flags) { Window_Main.Handle = win_handle; /* TODO grab using SDL_SetWindowGrab? seems to be unnecessary on Linux at least */ } + void Window_Create2D(int width, int height) { DoCreateWindow(width, height, 0); } +#if CC_GFX_BACKEND == CC_GFX_BACKEND_GL void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_WINDOW_OPENGL); } +#else +void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); } +#endif void Window_SetTitle(const cc_string* title) { char str[NATIVE_STR_LEN]; diff --git a/src/interop_ios.m b/src/interop_ios.m index 162d6d7e8..50afd79cf 100644 --- a/src/interop_ios.m +++ b/src/interop_ios.m @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include #ifdef TARGET_OS_TV @@ -690,8 +688,12 @@ cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) { /*#########################################################################################################################* - *--------------------------------------------------------2D window--------------------------------------------------------* + *-----------------------------------------------------Window creation-----------------------------------------------------* *#########################################################################################################################*/ +@interface CC3DView : UIView +@end +static void Init3DLayer(void); + void Window_Create2D(int width, int height) { launcherMode = true; CGRect bounds = DoCreateWindow(); @@ -701,49 +703,25 @@ void Window_Create2D(int width, int height) { cc_controller.view = view_handle; } - -/*#########################################################################################################################* - *--------------------------------------------------------3D window--------------------------------------------------------* - *#########################################################################################################################*/ -static void GLContext_OnLayout(void); - -@interface CCGLView : UIView -@end - -@implementation CCGLView - -+ (Class)layerClass { - return [CAEAGLLayer class]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - GLContext_OnLayout(); -} -@end - void Window_Create3D(int width, int height) { launcherMode = false; CGRect bounds = DoCreateWindow(); - // CAEAGLLayer - iOS 2.0 - view_handle = [[CCGLView alloc] initWithFrame:bounds]; + view_handle = [[CC3DView alloc] initWithFrame:bounds]; view_handle.multipleTouchEnabled = true; cc_controller.view = view_handle; - - CAEAGLLayer* layer = (CAEAGLLayer*)view_handle.layer; - layer.opaque = YES; - layer.drawableProperties = - @{ - kEAGLDrawablePropertyRetainedBacking : [NSNumber numberWithBool:NO], - kEAGLDrawablePropertyColorFormat : kEAGLColorFormatRGBA8 - }; + + Init3DLayer(); } /*########################################################################################################################* *--------------------------------------------------------GLContext--------------------------------------------------------* *#########################################################################################################################*/ +#if CC_GFX_BACKEND == CC_GFX_BACKEND_GL +#include +#include + static EAGLContext* ctx_handle; static GLuint framebuffer; static GLuint color_renderbuffer, depth_renderbuffer; @@ -837,14 +815,40 @@ cc_bool GLContext_SwapBuffers(void) { } void GLContext_SetFpsLimit(cc_bool vsync, float minFrameMs) { } void GLContext_GetApiInfo(cc_string* info) { } -const struct UpdaterInfo Updater_Info = { "&eCompile latest source code to update", 0 }; + + +@implementation CC3DView + ++ (Class)layerClass { + return [CAEAGLLayer class]; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + GLContext_OnLayout(); +} +@end + +static void Init3DLayer(void) { + // CAEAGLLayer - iOS 2.0 + CAEAGLLayer* layer = (CAEAGLLayer*)view_handle.layer; + + layer.opaque = YES; + layer.drawableProperties = + @{ + kEAGLDrawablePropertyRetainedBacking : [NSNumber numberWithBool:NO], + kEAGLDrawablePropertyColorFormat : kEAGLColorFormatRGBA8 + }; +} +#endif /*########################################################################################################################* *--------------------------------------------------------Updater----------------------------------------------------------* *#########################################################################################################################*/ -const char* const Updater_OGL = NULL; -const char* const Updater_D3D9 = NULL; +const struct UpdaterInfo Updater_Info = { + "&eRedownload and reinstall to update", 0 +}; cc_bool Updater_Clean(void) { return true; } cc_result Updater_GetBuildTime(cc_uint64* t) { @@ -873,6 +877,7 @@ cc_result Process_StartOpen(const cc_string* args) { // openURL - iOS 2.0 (deprecated) NSString* str = ToNSString(args); NSURL* url = [[NSURL alloc] initWithString:str]; + [UIApplication.sharedApplication openURL:url]; return 0; }