mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-13 23:33:13 +00:00
Added support for resizing windows on visionOS
This commit is contained in:
@@ -87,6 +87,7 @@ static SDL_VideoDevice *UIKit_CreateDevice(void)
|
||||
device->SuspendScreenSaver = UIKit_SuspendScreenSaver;
|
||||
device->CreateSDLWindow = UIKit_CreateWindow;
|
||||
device->SetWindowTitle = UIKit_SetWindowTitle;
|
||||
device->SetWindowSize = UIKit_SetWindowSize;
|
||||
device->ShowWindow = UIKit_ShowWindow;
|
||||
device->HideWindow = UIKit_HideWindow;
|
||||
device->RaiseWindow = UIKit_RaiseWindow;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
extern bool UIKit_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props);
|
||||
extern void UIKit_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void UIKit_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void UIKit_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void UIKit_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void UIKit_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
|
||||
@@ -247,6 +247,24 @@ void UIKit_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
}
|
||||
}
|
||||
|
||||
void UIKit_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
#ifdef SDL_PLATFORM_VISIONOS
|
||||
@autoreleasepool {
|
||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||
UIWindowScene *scene = data.uiwindow.windowScene;
|
||||
CGSize size = { window->pending.w, window->pending.h };
|
||||
UIWindowSceneGeometryPreferences *preferences = [[UIWindowSceneGeometryPreferencesVision alloc] initWithSize:size];
|
||||
[scene requestGeometryUpdateWithPreferences:preferences errorHandler:^(NSError * _Nonnull error) {
|
||||
// Request failed, no worries
|
||||
}];
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
return SDL_Unsupported();
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIKit_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
Reference in New Issue
Block a user