mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Introduce 'visionos' platform derived from 'apple_embedded'
This commit is contained in:
@@ -71,9 +71,13 @@ static GDTViewController *mainViewController = nil;
|
||||
// TODO: logo screen is not displayed while shaders are compiling
|
||||
// DummyViewController(Splash/LoadingViewController) -> setup -> GodotViewController
|
||||
|
||||
#if !defined(VISIONOS_ENABLED)
|
||||
// Create a full-screen window
|
||||
CGRect windowBounds = [[UIScreen mainScreen] bounds];
|
||||
self.window = [[UIWindow alloc] initWithFrame:windowBounds];
|
||||
#else
|
||||
self.window = [[UIWindow alloc] init];
|
||||
#endif
|
||||
|
||||
int err = apple_embedded_main(gargc, gargv);
|
||||
|
||||
|
||||
@@ -643,9 +643,12 @@ void DisplayServerAppleEmbedded::screen_set_orientation(DisplayServer::ScreenOri
|
||||
screen_orientation = p_orientation;
|
||||
if (@available(iOS 16.0, *)) {
|
||||
[GDTAppDelegateService.viewController setNeedsUpdateOfSupportedInterfaceOrientations];
|
||||
} else {
|
||||
}
|
||||
#if !defined(VISIONOS_ENABLED)
|
||||
else {
|
||||
[UIViewController attemptRotationToDeviceOrientation];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
DisplayServer::ScreenOrientation DisplayServerAppleEmbedded::screen_get_orientation(int p_screen) const {
|
||||
|
||||
@@ -117,7 +117,9 @@ static const float earth_gravity = 9.80665;
|
||||
}
|
||||
|
||||
- (void)godot_commonInit {
|
||||
#if !defined(VISIONOS_ENABLED)
|
||||
self.contentScaleFactor = [UIScreen mainScreen].scale;
|
||||
#endif
|
||||
|
||||
if (@available(iOS 17.0, *)) {
|
||||
[self registerForTraitChanges:@[ [UITraitUserInterfaceStyle class] ] withTarget:self action:@selector(traitCollectionDidChangeWithView:previousTraitCollection:)];
|
||||
@@ -148,7 +150,9 @@ static const float earth_gravity = 9.80665;
|
||||
|
||||
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
#if !defined(VISIONOS_ENABLED)
|
||||
[super traitCollectionDidChange:previousTraitCollection];
|
||||
#endif
|
||||
[self traitCollectionDidChangeWithView:self
|
||||
previousTraitCollection:previousTraitCollection];
|
||||
}
|
||||
@@ -419,6 +423,7 @@ static const float earth_gravity = 9.80665;
|
||||
|
||||
UIInterfaceOrientation interfaceOrientation = UIInterfaceOrientationUnknown;
|
||||
|
||||
#if !defined(VISIONOS_ENABLED)
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 140000
|
||||
interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
|
||||
#else
|
||||
@@ -430,6 +435,9 @@ static const float earth_gravity = 9.80665;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
interfaceOrientation = [UIApplication sharedApplication].delegate.window.windowScene.interfaceOrientation;
|
||||
#endif
|
||||
|
||||
switch (interfaceOrientation) {
|
||||
case UIInterfaceOrientationLandscapeLeft: {
|
||||
|
||||
@@ -187,6 +187,7 @@
|
||||
}
|
||||
|
||||
- (void)displayLoadingOverlay {
|
||||
#if !defined(VISIONOS_ENABLED)
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSString *storyboardName = @"Launch Screen";
|
||||
|
||||
@@ -202,6 +203,7 @@
|
||||
self.godotLoadingOverlay.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
||||
|
||||
[self.view addSubview:self.godotLoadingOverlay];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL)godotViewFinishedSetup:(GDTView *)view {
|
||||
|
||||
Reference in New Issue
Block a user