CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
iOSPlatform.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
12
14
16
17#if defined(__OBJC__)
18#include <UIKit/UIKit.h>
19#endif
20
21namespace CeresEngine {
22
23 class Engine;
24
25#if defined(__OBJC__)
27 NSString* toNSString(StringView string) noexcept;
28
30 String fromNSString(NSString* string) noexcept;
31
32// inline CGRect toCGRect(const Rect2& rect) noexcept { return CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); }
33// inline Rect2 fromCGRect(const CGRect& rect) noexcept { return Rect2(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); }
34
35// inline CGPoint toCGPoint(const Point2& point) noexcept { return CGPointMake(point.x, point.y); }
36// inline Point2 fromCGPoint(const CGPoint& point) noexcept { return Point2(point.x, point.y); }
37//
38// inline CGSize toCGSize(const Size2& size) noexcept { return CGSizeMake(size.width, size.height); }
39// inline Size2 fromCGSize(const CGSize& size) noexcept { return Size2(size.width, size.height); }
40#endif
41
43 class iOSPlatform : public ApplePlatform {
44 public:
45 struct Pimpl;
46 friend struct Pimpl;
47
48 private:
51
52 public:
55
58
59 public: // Main RunLoop
60 static void main();
61
63 void run() override;
64
66 void stop() override;
67
68 public:
74
75 public:
77 };
78
79} // namespace CeresEngine
A platform implementation for Apple.
Definition ApplePlatform.hpp:34
Definition Engine.hpp:38
Definition PlatformWindow.hpp:44
A platform implementation for iOS.
Definition iOSPlatform.hpp:43
static String getResourcesDirectory()
~iOSPlatform() noexcept override
Creates a new iOS platform instance.
void stop() override
Requests the application to stop running.
friend struct Pimpl
Definition iOSPlatform.hpp:46
UPtr< PlatformWindow > createWindow(const PlatformWindowDescriptor &descriptor) override
Creates a new platform window.
iOSPlatform(Engine &engine)
Creates a new iOS platform instance.
void run() override
Starts running the main application run loop.
UPtr< Pimpl > m
Hidden implementation class for the platform.
Definition iOSPlatform.hpp:50
Definition Application.hpp:19
std::unique_ptr< T, Deleter > UPtr
UPtr is a smart pointer that owns and manages another object through a pointer and disposes of that o...
Definition SmartPtr.hpp:28
BasicStringView< char > StringView
Narrow string view used for handling narrow encoded text in UTF-8.
Definition String.hpp:190
BasicString< char > String
Narrow string used for handling narrow encoded text in UTF-8.
Definition String.hpp:163
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
A structure that describes how to create a new window.
Definition PlatformWindow.hpp:24