فهرست منبع

support building against iOS SDK < 13.0

Andrey Filipenkov 3 سال پیش
والد
کامیت
b8eef4ce35
3فایلهای تغییر یافته به همراه13 افزوده شده و 0 حذف شده
  1. 9 0
      Global.h
  2. 2 0
      client/ios/startSDL.mm
  3. 2 0
      launcher/ios/main.m

+ 9 - 0
Global.h

@@ -264,6 +264,15 @@ template<typename T, size_t N> char (&_ArrayCountObj(const T (&)[N]))[N];
 // should be used for variables that becomes unused in release builds (e.g. only used for assert checks)
 #define UNUSED(VAR) ((void)VAR)
 
+// old iOS SDKs compatibility
+#ifdef VCMI_IOS
+#include <AvailabilityVersions.h>
+
+#ifndef __IPHONE_13_0
+#define __IPHONE_13_0 130000
+#endif
+#endif // VCMI_IOS
+
 // single-process build makes 2 copies of the main lib by wrapping it in a namespace
 #ifdef VCMI_LIB_NAMESPACE
 #define VCMI_LIB_NAMESPACE_BEGIN namespace VCMI_LIB_NAMESPACE {

+ 2 - 0
client/ios/startSDL.mm

@@ -46,9 +46,11 @@
 	textField.frame = r;
     self.gameChatHandler.textFieldSDL = textField;
 
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
 	if(@available(iOS 13.0, *))
 		textField.backgroundColor = UIColor.systemBackgroundColor;
 	else
+#endif
 		textField.backgroundColor = UIColor.whiteColor;
 
     auto longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];

+ 2 - 0
launcher/ios/main.m

@@ -21,8 +21,10 @@ void launchGame(int argc, char * argv[]) {
 		qtNativeWindow.hidden = YES;
 		[qtNativeWindow.rootViewController.view removeFromSuperview];
 		qtNativeWindow.rootViewController = nil;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
 		if (@available(iOS 13.0, *))
 			qtNativeWindow.windowScene = nil;
+#endif
 	}
 	[NSNotificationCenter.defaultCenter postNotificationName:@"StartGame" object:nil];
 }