Merge branch '1.12'
This commit is contained in:
@@ -401,7 +401,15 @@ bool GPUSwapChainVulkan::CreateSwapChain(int32 width, int32 height)
|
||||
VkBool32 supportsPresent;
|
||||
VALIDATE_VULKAN_RESULT(vkGetPhysicalDeviceSurfaceSupportKHR(gpu, _device->PresentQueue->GetFamilyIndex(), _surface, &supportsPresent));
|
||||
ASSERT(supportsPresent);
|
||||
#if PLATFORM_IOS
|
||||
Function<void()> func = [this, &device, &swapChainInfo]()
|
||||
{
|
||||
VALIDATE_VULKAN_RESULT(vkCreateSwapchainKHR(device, &swapChainInfo, nullptr, &_swapChain));
|
||||
};
|
||||
iOSPlatform::RunOnUIThread(func, true);
|
||||
#else
|
||||
VALIDATE_VULKAN_RESULT(vkCreateSwapchainKHR(device, &swapChainInfo, nullptr, &_swapChain));
|
||||
#endif
|
||||
|
||||
// Cache data
|
||||
_width = width;
|
||||
|
||||
@@ -23,7 +23,7 @@ FLAXENGINE_API
|
||||
@end
|
||||
|
||||
FLAXENGINE_API
|
||||
@interface FlaxAppDelegate : UIResponder <UIApplicationDelegate>
|
||||
@interface FlaxAppDelegate : UIResponder <UIApplicationDelegate, UIWindowSceneDelegate>
|
||||
|
||||
@property(strong, retain, nonatomic) UIWindow* window;
|
||||
@property(strong, retain, nonatomic) FlaxViewController* viewController;
|
||||
|
||||
@@ -248,11 +248,13 @@ MessagePipeline MainThreadPipeline;
|
||||
UIThreadPipeline.Run();
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
|
||||
- (void)scene:(UIScene*)scene willConnectToSession:(UISceneSession*)session options:(UISceneConnectionOptions*)connectionOptions
|
||||
{
|
||||
//LOG(Info, "[iOS] willConnectToSession");
|
||||
|
||||
// Create window
|
||||
CGRect frame = [[UIScreen mainScreen] bounds];
|
||||
self.window = [[UIWindow alloc] initWithFrame:frame];
|
||||
self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene*)scene];
|
||||
|
||||
// Create view
|
||||
self.view = [[FlaxView alloc] initWithFrame:frame];
|
||||
@@ -271,10 +273,80 @@ MessagePipeline MainThreadPipeline;
|
||||
[self.viewController setNeedsStatusBarAppearanceUpdate];
|
||||
MainViewController = self.viewController;
|
||||
|
||||
// Create navigation controller
|
||||
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
|
||||
[self.window setRootViewController:navController];
|
||||
// Link controller and show window
|
||||
self.window.rootViewController = MainViewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
}
|
||||
|
||||
- (UISceneConfiguration*)application:(UIApplication*)application configurationForConnectingSceneSession:(UISceneSession*)connectingSceneSession options:(UISceneConnectionOptions*)options API_AVAILABLE(ios(13.0), tvos(13.0), visionos(1.0))
|
||||
{
|
||||
LOG(Info, "[iOS] configurationForConnectingSceneSession");
|
||||
UISceneConfiguration* config = [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
|
||||
config.delegateClass = [FlaxAppDelegate class];
|
||||
return config;
|
||||
}
|
||||
|
||||
- (void)application:(UIApplication*)application didDiscardSceneSessions:(NSSet<UISceneSession*>*)sceneSessions API_AVAILABLE(ios(13.0), tvos(13.0), visionos(1.0))
|
||||
{
|
||||
LOG(Info, "[iOS] didDiscardSceneSessions");
|
||||
}
|
||||
|
||||
- (void)sceneDidDisconnect:(UIScene*)scene API_AVAILABLE(ios(13.0), tvos(13.0), visionos(1.0))
|
||||
{
|
||||
LOG(Info, "[iOS] sceneDidDisconnect");
|
||||
}
|
||||
|
||||
- (void)sceneDidBecomeActive:(UIScene*)scene API_AVAILABLE(ios(13.0), tvos(13.0), visionos(1.0))
|
||||
{
|
||||
LOG(Info, "[iOS] sceneDidBecomeActive");
|
||||
|
||||
// Focus app
|
||||
HasFocus = true;
|
||||
if (MainWindow)
|
||||
{
|
||||
Function<void()> func = []()
|
||||
{
|
||||
MainWindow->OnGotFocus();
|
||||
};
|
||||
iOSPlatform::RunOnMainThread(func);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sceneWillResignActive:(UIScene*)scene API_AVAILABLE(ios(13.0), tvos(13.0), visionos(1.0))
|
||||
{
|
||||
LOG(Info, "[iOS] sceneWillResignActive");
|
||||
|
||||
// Defocus app
|
||||
HasFocus = false;
|
||||
if (MainWindow)
|
||||
{
|
||||
Function<void()> func = []()
|
||||
{
|
||||
MainWindow->OnLostFocus();
|
||||
};
|
||||
iOSPlatform::RunOnMainThread(func);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sceneDidEnterBackground:(UIScene*)scene API_AVAILABLE(ios(13.0), tvos(13.0), visionos(1.0))
|
||||
{
|
||||
LOG(Info, "[iOS] sceneDidEnterBackground");
|
||||
|
||||
// Pause
|
||||
IsPaused = true;
|
||||
}
|
||||
|
||||
- (void)sceneWillEnterForeground:(UIScene*)scene API_AVAILABLE(ios(13.0), tvos(13.0), visionos(1.0))
|
||||
{
|
||||
LOG(Info, "[iOS] sceneDidEnterBackground");
|
||||
|
||||
// Resume
|
||||
IsPaused = false;
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
|
||||
{
|
||||
//LOG(Info, "[iOS] didFinishLaunchingWithOptions");
|
||||
|
||||
// Create UI thread update callback
|
||||
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(UIThreadMain)];
|
||||
|
||||
@@ -2083,10 +2083,23 @@ static MonoAssembly* OnMonoAssemblyLoad(const char* aname)
|
||||
LOG(Info, "Loading C# assembly from path = {0}, exist = {1}", path, FileSystem::FileExists(path));
|
||||
#endif
|
||||
MonoAssembly* assembly = nullptr;
|
||||
MonoImageOpenStatus status = MONO_IMAGE_IMAGE_INVALID;
|
||||
if (FileSystem::FileExists(path))
|
||||
{
|
||||
StringAnsi pathAnsi(path);
|
||||
assembly = mono_assembly_open(pathAnsi.Get(), nullptr);
|
||||
#if PLATFORM_IOS
|
||||
Array<byte> data;
|
||||
File::ReadAllBytes(path, data);
|
||||
const auto name = path.ToStringAnsi();
|
||||
const auto assemblyImage = mono_image_open_from_data_with_name(reinterpret_cast<char*>(data.Get()), data.Count(), true, &status, false, name.Get());
|
||||
if (assemblyImage)
|
||||
{
|
||||
assembly = mono_assembly_load_from_full(assemblyImage, name.Substring(0, name.Length() - 3).Get(), &status, false);
|
||||
mono_image_close(assemblyImage);
|
||||
}
|
||||
#else
|
||||
assembly = mono_assembly_open(pathAnsi.Get(), &status);
|
||||
#endif
|
||||
}
|
||||
if (!assembly)
|
||||
{
|
||||
|
||||
@@ -223,7 +223,7 @@ ${PBXResourcesGroup}
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "${HeaderSearchPaths}";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@@ -276,7 +276,7 @@ ${PBXResourcesGroup}
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "${HeaderSearchPaths}";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -293,6 +293,7 @@ ${PBXResourcesGroup}
|
||||
CURRENT_PROJECT_VERSION = ${AppVersion};
|
||||
DEVELOPMENT_TEAM = ${AppTeamId};
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = FlaxGame/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "${ProjectName}";
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
@@ -302,7 +303,7 @@ ${PBXResourcesGroup}
|
||||
INFOPLIST_KEY_UIStatusBarHidden = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "${UISupportedInterfaceOrientations_iPad}";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "${UISupportedInterfaceOrientations_iPhone}";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@@ -333,6 +334,7 @@ ${PBXResourcesGroup}
|
||||
CURRENT_PROJECT_VERSION = ${AppVersion};
|
||||
DEVELOPMENT_TEAM = ${AppTeamId};
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = FlaxGame/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "${ProjectName}";
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
@@ -342,7 +344,7 @@ ${PBXResourcesGroup}
|
||||
INFOPLIST_KEY_UIStatusBarHidden = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "${UISupportedInterfaceOrientations_iPad}";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "${UISupportedInterfaceOrientations_iPhone}";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
<key>UISceneConfigurations</key>
|
||||
<dict>
|
||||
<key>UIWindowSceneSessionRoleApplication</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UISceneConfigurationName</key>
|
||||
<string>Default Configuration</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user