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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user