Refactor iOS deployment to use XCode project
This commit is contained in:
@@ -51,7 +51,6 @@
|
||||
|
||||
Guid DeviceId;
|
||||
String ComputerName;
|
||||
NSAutoreleasePool* AutoreleasePool = nullptr;
|
||||
|
||||
DialogResult MessageBox::Show(Window* parent, const StringView& text, const StringView& caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
@@ -232,7 +231,6 @@ bool MacPlatform::Init()
|
||||
// Init application
|
||||
[NSApplication sharedApplication];
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
AutoreleasePool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
// Init main menu
|
||||
NSMenu* mainMenu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
|
||||
@@ -276,8 +274,7 @@ void MacPlatform::Tick()
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
|
||||
[AutoreleasePool drain];
|
||||
AutoreleasePool = [[NSAutoreleasePool alloc] init];
|
||||
ApplePlatform::Tick();
|
||||
}
|
||||
|
||||
int32 MacPlatform::GetDpi()
|
||||
|
||||
34
Source/Engine/Platform/iOS/iOSApp.h
Normal file
34
Source/Engine/Platform/iOS/iOSApp.h
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef PLATFORM_IOS
|
||||
// When included from generated XCode main.m file
|
||||
#define PLATFORM_IOS 1
|
||||
#define FLAXENGINE_API
|
||||
#endif
|
||||
|
||||
#if PLATFORM_IOS
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
FLAXENGINE_API
|
||||
@interface FlaxView : UIView
|
||||
|
||||
@end
|
||||
|
||||
FLAXENGINE_API
|
||||
@interface FlaxViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
FLAXENGINE_API
|
||||
@interface FlaxAppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property(strong, retain, nonatomic) UIWindow* window;
|
||||
@property(strong, retain, nonatomic) FlaxViewController* viewController;
|
||||
@property(strong, retain, nonatomic) FlaxView* view;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -12,6 +12,7 @@
|
||||
class FLAXENGINE_API iOSFileSystem : public AppleFileSystem
|
||||
{
|
||||
public:
|
||||
// [AppleFileSystem]
|
||||
static bool FileExists(const StringView& path);
|
||||
static uint64 GetFileSize(const StringView& path);
|
||||
static bool IsReadOnly(const StringView& path);
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
#include "iOSWindow.h"
|
||||
#include "iOSFile.h"
|
||||
#include "iOSFileSystem.h"
|
||||
#include "iOSApp.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Delegate.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Platform/Apple/AppleUtils.h"
|
||||
@@ -15,20 +17,158 @@
|
||||
#include "Engine/Platform/Window.h"
|
||||
#include "Engine/Platform/WindowsManager.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Input/Input.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include <UIKit/UIKit.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <QuartzCore/CAMetalLayer.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
int32 Dpi = 96;
|
||||
Guid DeviceId;
|
||||
FlaxView* MainView = nullptr;
|
||||
FlaxViewController* MainViewController = nullptr;
|
||||
iOSWindow* MainWindow = nullptr;
|
||||
CriticalSection UIThreadFuncLocker;
|
||||
Array<Function<void()>> UIThreadFuncList;
|
||||
|
||||
// Used by iOS project in XCode to run engine (see main.m)
|
||||
extern "C" FLAXENGINE_API int FlaxEngineMain()
|
||||
@implementation FlaxView
|
||||
|
||||
+(Class) layerClass { return [CAMetalLayer class]; }
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
return Engine::Main(TEXT(""));
|
||||
[super setFrame:frame];
|
||||
if (!MainWindow)
|
||||
return;
|
||||
float scale = [[UIScreen mainScreen] scale];
|
||||
MainWindow->CheckForResize((float)frame.size.width * scale, (float)frame.size.height * scale);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FlaxViewController
|
||||
|
||||
- (BOOL)prefersHomeIndicatorAutoHidden
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(UIStatusBarAnimation)preferredStatusBarUpdateAnimation
|
||||
{
|
||||
return UIStatusBarAnimationSlide;
|
||||
}
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
UILabel *label = [[UILabel alloc] initWithFrame:self.view.bounds];
|
||||
[label setText:@"Hello World from Flax"];
|
||||
[label setBackgroundColor:[UIColor systemBackgroundColor]];
|
||||
[label setTextAlignment:NSTextAlignmentCenter];
|
||||
self.view = label;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface FlaxAppDelegate()
|
||||
|
||||
@property(strong, nonatomic) CADisplayLink* displayLink;
|
||||
|
||||
@end
|
||||
|
||||
@implementation FlaxAppDelegate
|
||||
|
||||
-(void)GameThreadMain:(NSDictionary*)launchOptions
|
||||
{
|
||||
// Run engine on a separate game thread
|
||||
Engine::Main(TEXT(""));
|
||||
}
|
||||
|
||||
-(void)UIThreadMain
|
||||
{
|
||||
// Invoke callbacks
|
||||
UIThreadFuncLocker.Lock();
|
||||
for (const auto& func : UIThreadFuncList)
|
||||
{
|
||||
func();
|
||||
}
|
||||
UIThreadFuncList.Clear();
|
||||
UIThreadFuncLocker.Unlock();
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
// Create window
|
||||
CGRect frame = [[UIScreen mainScreen] bounds];
|
||||
self.window = [[UIWindow alloc] initWithFrame:frame];
|
||||
|
||||
// Create view controller
|
||||
self.viewController = [[FlaxViewController alloc] init];
|
||||
MainViewController = self.viewController;
|
||||
|
||||
// Create view
|
||||
self.view = [[FlaxView alloc] initWithFrame:frame];
|
||||
[self.view resignFirstResponder];
|
||||
[self.view setNeedsDisplay];
|
||||
[self.view setHidden:NO];
|
||||
[self.view setOpaque:YES];
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
MainView = self.view;
|
||||
|
||||
// Create navigation controller
|
||||
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
|
||||
[self.window setRootViewController:navController];
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
// Create UI thread update callback
|
||||
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(UIThreadMain)];
|
||||
self.displayLink.preferredFramesPerSecond = 30;
|
||||
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
|
||||
|
||||
// Run engine on a separate game thread
|
||||
NSThread* gameThread = [[NSThread alloc] initWithTarget:self selector:@selector(GameThreadMain:) object:launchOptions];
|
||||
#if BUILD_DEBUG
|
||||
const int32 gameThreadStackSize = 4 * 1024 * 1024; // 4 MB
|
||||
#else
|
||||
const int32 gameThreadStackSize = 2 * 1024 * 1024; // 2 MB
|
||||
#endif
|
||||
[gameThread setStackSize:gameThreadStackSize];
|
||||
[gameThread start];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application
|
||||
{
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||
{
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||
{
|
||||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||
{
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
DialogResult MessageBox::Show(Window* parent, const StringView& text, const StringView& caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
NSString* title = (NSString*)AppleUtils::ToString(caption);
|
||||
@@ -36,28 +176,89 @@ DialogResult MessageBox::Show(Window* parent, const StringView& text, const Stri
|
||||
UIAlertController* alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction* button = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:^(id){ }];
|
||||
[alert addAction:button];
|
||||
ScopeLock lock(WindowsManager::WindowsLocker);
|
||||
for (auto window : WindowsManager::Windows)
|
||||
{
|
||||
if (window->IsVisible())
|
||||
{
|
||||
[(UIViewController*)window->GetViewController() presentViewController:alert animated:YES completion:nil];
|
||||
break;
|
||||
}
|
||||
}
|
||||
[MainViewController presentViewController:alert animated:YES completion:nil];
|
||||
return DialogResult::OK;
|
||||
}
|
||||
|
||||
iOSWindow::iOSWindow(const CreateWindowSettings& settings)
|
||||
: WindowBase(settings)
|
||||
{
|
||||
CGRect frame = [[UIScreen mainScreen] bounds];
|
||||
float scale = [[UIScreen mainScreen] scale];
|
||||
_clientSize = Float2((float)frame.size.width * scale, (float)frame.size.height * scale);
|
||||
|
||||
MainWindow = this;
|
||||
}
|
||||
|
||||
iOSWindow::~iOSWindow()
|
||||
{
|
||||
MainWindow = nullptr;
|
||||
}
|
||||
|
||||
void iOSWindow::CheckForResize(float width, float height)
|
||||
{
|
||||
const Float2 clientSize(width, height);
|
||||
if (clientSize != _clientSize)
|
||||
{
|
||||
_clientSize = clientSize;
|
||||
OnResize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void* iOSWindow::GetNativePtr() const
|
||||
{
|
||||
return MainView;
|
||||
}
|
||||
|
||||
void iOSWindow::Show()
|
||||
{
|
||||
if (!_visible)
|
||||
{
|
||||
InitSwapChain();
|
||||
if (_showAfterFirstPaint)
|
||||
{
|
||||
if (RenderTask)
|
||||
RenderTask->Enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Show
|
||||
_focused = true;
|
||||
|
||||
// Base
|
||||
WindowBase::Show();
|
||||
}
|
||||
}
|
||||
|
||||
bool iOSWindow::IsClosed() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool iOSWindow::IsForegroundWindow() const
|
||||
{
|
||||
return Platform::GetHasFocus() && IsFocused();
|
||||
}
|
||||
|
||||
void iOSWindow::BringToFront(bool force)
|
||||
{
|
||||
Focus();
|
||||
}
|
||||
|
||||
void iOSWindow::SetIsFullscreen(bool isFullscreen)
|
||||
{
|
||||
}
|
||||
|
||||
// Fallback to file placed side-by-side with application
|
||||
#define IOS_FALLBACK_PATH(path) (Globals::ProjectFolder / StringUtils::GetFileName(path))
|
||||
|
||||
iOSFile* iOSFile::Open(const StringView& path, FileMode mode, FileAccess access, FileShare share)
|
||||
{
|
||||
iOSFile* file = (iOSFile*)UnixFile::Open(path, mode, access, share);
|
||||
if (!file && mode == FileMode::OpenExisting)
|
||||
{
|
||||
// Fallback to file placed side-by-side with application
|
||||
iOSFile* file;
|
||||
if (mode == FileMode::OpenExisting && !AppleFileSystem::FileExists(path))
|
||||
file = (iOSFile*)UnixFile::Open(IOS_FALLBACK_PATH(path), mode, access, share);
|
||||
}
|
||||
else
|
||||
file = (iOSFile*)UnixFile::Open(path, mode, access, share);
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -82,6 +283,22 @@ bool iOSFileSystem::IsReadOnly(const StringView& path)
|
||||
|
||||
#undef IOS_FALLBACK_PATH
|
||||
|
||||
void iOSPlatform::RunOnUIThread(const Function<void()>& func, bool wait)
|
||||
{
|
||||
UIThreadFuncLocker.Lock();
|
||||
UIThreadFuncList.Add(func);
|
||||
UIThreadFuncLocker.Unlock();
|
||||
|
||||
// TODO: use atomic counters for more optimized waiting
|
||||
while (wait)
|
||||
{
|
||||
Platform::Sleep(1);
|
||||
UIThreadFuncLocker.Lock();
|
||||
wait = UIThreadFuncList.HasItems();
|
||||
UIThreadFuncLocker.Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool iOSPlatform::Init()
|
||||
{
|
||||
if (ApplePlatform::Init())
|
||||
@@ -113,10 +330,9 @@ void iOSPlatform::LogInfo()
|
||||
|
||||
void iOSPlatform::Tick()
|
||||
{
|
||||
// Process system events
|
||||
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0001, true) == kCFRunLoopRunHandledSource)
|
||||
{
|
||||
}
|
||||
// TODO: get events from UI Thread
|
||||
|
||||
ApplePlatform::Tick();
|
||||
}
|
||||
|
||||
int32 iOSPlatform::GetDpi()
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
/// </summary>
|
||||
class FLAXENGINE_API iOSPlatform : public ApplePlatform
|
||||
{
|
||||
public:
|
||||
// Runs the callback on a main UI thread (from iOS). Can optionally wait for execution end to sync.
|
||||
static void RunOnUIThread(const Function<void()>& func, bool wait = false);
|
||||
|
||||
public:
|
||||
|
||||
// [ApplePlatform]
|
||||
|
||||
@@ -13,6 +13,12 @@ API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(ApplePlatformSettings);
|
||||
|
||||
/// <summary>
|
||||
/// The app developer name - App Store Team ID.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(10), EditorDisplay(\"General\")")
|
||||
String AppTeamId;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instance of the settings asset (default value if missing). Object returned by this method is always loaded with valid data to use.
|
||||
/// </summary>
|
||||
@@ -22,6 +28,7 @@ API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings") class FLAXENGINE_API
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) final override
|
||||
{
|
||||
ApplePlatformSettings::Deserialize(stream, modifier);
|
||||
DESERIALIZE(AppTeamId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,211 +0,0 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
#if PLATFORM_IOS
|
||||
|
||||
#include "../Window.h"
|
||||
#include "Engine/Platform/Apple/AppleUtils.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Input/Input.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include <UIKit/UIKit.h>
|
||||
#include <QuartzCore/CAMetalLayer.h>
|
||||
|
||||
@interface iOSUIWindow : UIWindow
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation iOSUIWindow
|
||||
|
||||
@end
|
||||
|
||||
@interface iOSUIViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
@interface iOSUIView : UIView
|
||||
|
||||
@property iOSWindow* window;
|
||||
|
||||
@end
|
||||
|
||||
@implementation iOSUIView
|
||||
|
||||
+(Class) layerClass { return [CAMetalLayer class]; }
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
[super setFrame:frame];
|
||||
if (!_window)
|
||||
return;
|
||||
float scale = [[UIScreen mainScreen] scale];
|
||||
_window->CheckForResize((float)frame.size.width * scale, (float)frame.size.height * scale);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation iOSUIViewController
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)prefersHomeIndicatorAutoHidden
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(UIStatusBarAnimation)preferredStatusBarUpdateAnimation
|
||||
{
|
||||
return UIStatusBarAnimationSlide;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
iOSWindow::iOSWindow(const CreateWindowSettings& settings)
|
||||
: WindowBase(settings)
|
||||
{
|
||||
// Fullscreen by default
|
||||
CGRect frame = [[UIScreen mainScreen] bounds];
|
||||
float scale = [[UIScreen mainScreen] scale];
|
||||
_clientSize = Float2((float)frame.size.width * scale, (float)frame.size.height * scale);
|
||||
|
||||
// Setup view
|
||||
_view = [[iOSUIView alloc] initWithFrame:frame];
|
||||
iOSUIView* v = (iOSUIView*)_view;
|
||||
[v resignFirstResponder];
|
||||
[v setNeedsDisplay];
|
||||
[v setHidden:NO];
|
||||
[v setOpaque:YES];
|
||||
v.backgroundColor = [UIColor clearColor];
|
||||
v.window = this;
|
||||
|
||||
// Setp view controller
|
||||
_viewController = [[iOSUIViewController alloc] init];
|
||||
iOSUIViewController* vc = (iOSUIViewController*)_viewController;
|
||||
[vc setView:v];
|
||||
[vc setNeedsUpdateOfHomeIndicatorAutoHidden];
|
||||
[vc setNeedsStatusBarAppearanceUpdate];
|
||||
|
||||
// Setup window
|
||||
_window = [[iOSUIWindow alloc] initWithFrame:frame];
|
||||
iOSUIWindow* w = (iOSUIWindow*)_window;
|
||||
[w setRootViewController:vc];
|
||||
[w setContentMode:UIViewContentModeScaleToFill];
|
||||
[w makeKeyAndVisible];
|
||||
[w setBounds:frame];
|
||||
w.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
iOSWindow::~iOSWindow()
|
||||
{
|
||||
[(iOSUIWindow*)_window release];
|
||||
[(iOSUIView*)_view release];
|
||||
[(iOSUIViewController*)_viewController release];
|
||||
|
||||
_window = nullptr;
|
||||
_view = nullptr;
|
||||
_layer = nullptr;
|
||||
}
|
||||
|
||||
void iOSWindow::CheckForResize(float width, float height)
|
||||
{
|
||||
const Float2 clientSize(width, height);
|
||||
if (clientSize != _clientSize)
|
||||
{
|
||||
_clientSize = clientSize;
|
||||
OnResize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void* iOSWindow::GetNativePtr() const
|
||||
{
|
||||
return _window;
|
||||
}
|
||||
|
||||
void iOSWindow::Show()
|
||||
{
|
||||
if (!_visible)
|
||||
{
|
||||
InitSwapChain();
|
||||
if (_showAfterFirstPaint)
|
||||
{
|
||||
if (RenderTask)
|
||||
RenderTask->Enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Show
|
||||
_focused = true;
|
||||
|
||||
// Base
|
||||
WindowBase::Show();
|
||||
}
|
||||
}
|
||||
|
||||
bool iOSWindow::IsClosed() const
|
||||
{
|
||||
return _window != nullptr;
|
||||
}
|
||||
|
||||
bool iOSWindow::IsForegroundWindow() const
|
||||
{
|
||||
return Platform::GetHasFocus() && IsFocused();
|
||||
}
|
||||
|
||||
void iOSWindow::BringToFront(bool force)
|
||||
{
|
||||
Focus();
|
||||
}
|
||||
|
||||
void iOSWindow::SetIsFullscreen(bool isFullscreen)
|
||||
{
|
||||
}
|
||||
|
||||
void iOSWindow::SetClientBounds(const Rectangle& clientArea)
|
||||
{
|
||||
}
|
||||
|
||||
void iOSWindow::SetPosition(const Float2& position)
|
||||
{
|
||||
}
|
||||
|
||||
Float2 iOSWindow::GetPosition() const
|
||||
{
|
||||
return Float2::Zero;
|
||||
}
|
||||
|
||||
Float2 iOSWindow::GetSize() const
|
||||
{
|
||||
return _clientSize;
|
||||
}
|
||||
|
||||
Float2 iOSWindow::GetClientSize() const
|
||||
{
|
||||
return _clientSize;
|
||||
}
|
||||
|
||||
Float2 iOSWindow::ScreenToClient(const Float2& screenPos) const
|
||||
{
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
Float2 iOSWindow::ClientToScreen(const Float2& clientPos) const
|
||||
{
|
||||
return clientPos;
|
||||
}
|
||||
|
||||
void iOSWindow::SetTitle(const StringView& title)
|
||||
{
|
||||
_title = title;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -5,46 +5,26 @@
|
||||
#if PLATFORM_IOS
|
||||
|
||||
#include "Engine/Platform/Base/WindowBase.h"
|
||||
#include "Engine/Platform/Platform.h"
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the window class for iOS platform.
|
||||
/// </summary>
|
||||
class FLAXENGINE_API iOSWindow : public WindowBase
|
||||
{
|
||||
private:
|
||||
|
||||
Float2 _clientSize;
|
||||
void* _window;
|
||||
void* _layer;
|
||||
void* _view;
|
||||
void* _viewController;
|
||||
|
||||
public:
|
||||
|
||||
iOSWindow(const CreateWindowSettings& settings);
|
||||
~iOSWindow();
|
||||
|
||||
void CheckForResize(float width, float height);
|
||||
void* GetViewController() const { return _viewController; }
|
||||
|
||||
public:
|
||||
|
||||
// [Window]
|
||||
// [WindowBase]
|
||||
void* GetNativePtr() const override;
|
||||
void Show() override;
|
||||
bool IsClosed() const override;
|
||||
bool IsForegroundWindow() const override;
|
||||
void BringToFront(bool force = false) override;
|
||||
void SetClientBounds(const Rectangle& clientArea) override;
|
||||
void SetPosition(const Float2& position) override;
|
||||
Float2 GetPosition() const override;
|
||||
Float2 GetSize() const override;
|
||||
Float2 GetClientSize() const override;
|
||||
Float2 ScreenToClient(const Float2& screenPos) const override;
|
||||
Float2 ClientToScreen(const Float2& clientPos) const override;
|
||||
void SetIsFullscreen(bool isFullscreen) override;
|
||||
void SetTitle(const StringView& title) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user