CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
MacOSPlatform.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 <Foundation/Foundation.h>
19#endif
20
21namespace CeresEngine {
22
23 class Engine;
24
25#if defined(__OBJC__)
26 inline CGRect toCGRect(const Rect2& rect) noexcept { return CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); }
27 inline Rect2 fromCGRect(const CGRect& rect) noexcept { return Rect2(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); }
28
29 inline CGPoint toCGPoint(const Point2& point) noexcept { return CGPointMake(point.x, point.y); }
30 inline Point2 fromCGPoint(const CGPoint& point) noexcept { return Point2(point.x, point.y); }
31
32 inline CGSize toCGSize(const Size2& size) noexcept { return CGSizeMake(size.width, size.height); }
33 inline Size2 fromCGSize(const CGSize& size) noexcept { return Size2(size.width, size.height); }
34#endif
35
39
40 public:
41 struct Pimpl;
42 friend struct Pimpl;
43
44 private:
47
48 public:
51
54
55 public: // Main RunLoop
57 void run() final;
58
60 void stop() final;
61
62 public:
68 };
69
70} // namespace CeresEngine
A platform implementation for Apple.
Definition ApplePlatform.hpp:34
Definition Engine.hpp:38
A platform implementation for macOS.
Definition MacOSPlatform.hpp:37
UPtr< PlatformWindow > createWindow(const PlatformWindowDescriptor &descriptor) override
Creates a new platform window.
void stop() final
Requests the application to stop running.
~MacOSPlatform() noexcept override
Creates a new MacOS platform instance.
MacOSPlatform(Engine &engine)
Creates a new MacOS platform instance.
friend struct Pimpl
Definition MacOSPlatform.hpp:42
UPtr< Pimpl > m
Hidden implementation class for the platform.
Definition MacOSPlatform.hpp:46
void run() final
Starts running the main application run loop.
Definition PlatformWindow.hpp:44
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
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
TSize2< double > Size2
A structure that contains width and height values.
Definition Rect.hpp:60
TRect2< double > Rect2
Represents a 2D rectangle using real values.
Definition Rect.hpp:240
TPoint2< double > Point2
A type that contains a point in a two-dimensional coordinate system.
Definition Rect.hpp:24
A structure that describes how to create a new window.
Definition PlatformWindow.hpp:24