Implement visionOS support

This commit is contained in:
Ravbug
2023-07-23 23:11:09 -07:00
committed by Sam Lantinga
parent e385d6da0a
commit 690eae7d22
15 changed files with 217 additions and 41 deletions

View File

@@ -162,7 +162,9 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
{
displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(doLoop:)];
#ifdef __IPHONE_10_3
#if TARGET_OS_XR
displayLink.preferredFramesPerSecond = 90 / animationInterval; //TODO: Get frame max frame rate on visionOS
#elif defined(__IPHONE_10_3)
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] && data != nil && data.uiwindow != nil && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) {
@@ -511,7 +513,11 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
{
CGAffineTransform t = self.view.transform;
CGPoint offset = CGPointMake(0.0, 0.0);
#if TARGET_OS_XR
CGRect frame = UIKit_ComputeViewFrame(window);
#else
CGRect frame = UIKit_ComputeViewFrame(window, self.view.window.screen);
#endif
if (self.keyboardHeight) {
int rectbottom = self.textInputRect.y + self.textInputRect.h;