CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::Platform Class Referenceabstract

#include <CeresEngine/Platform/Platform.hpp>

Inheritance diagram for CeresEngine::Platform:
CeresEngine::POSIXPlatform CeresEngine::Win32Platform CeresEngine::ApplePlatform CeresEngine::EmscriptenPlatform CeresEngine::LinuxPlatform CeresEngine::MacOSPlatform CeresEngine::iOSPlatform

Public Member Functions

 Platform (Engine &engine)
 
virtual ~Platform () noexcept
 
virtual void run ()=0
 Starts running the main application run loop.
 
virtual void stop ()=0
 Requests the application to stop running.
 
virtual UPtr< PlatformWindowcreateWindow (const PlatformWindowDescriptor &descriptor)=0
 Creates a new platform window.
 
virtual UPtr< DispatchQueuecreateDispatchQueue (DispatchQueueType type, StringView name="")=0
 Creates a new queue to which you can submit blocks.
 
virtual IFileSystemgetLocalFileSystem () const
 Gets the underlying platform local file system implementation.
 
virtual FileHandle openFile (const FilePath &path) const
 Opens a file on the local file system.
 

Static Public Member Functions

static Platformget () noexcept
 Gets the current platform. Assets if no platform was initialized.
 

Constructor & Destructor Documentation

◆ Platform()

CeresEngine::Platform::Platform ( Engine engine)
explicit

◆ ~Platform()

virtual CeresEngine::Platform::~Platform ( )
virtualnoexcept

Member Function Documentation

◆ createDispatchQueue()

virtual UPtr< DispatchQueue > CeresEngine::Platform::createDispatchQueue ( DispatchQueueType  type,
StringView  name = "" 
)
pure virtual

Creates a new queue to which you can submit blocks.

Implemented in CeresEngine::ApplePlatform, CeresEngine::EmscriptenPlatform, and CeresEngine::Win32Platform.

◆ createWindow()

virtual UPtr< PlatformWindow > CeresEngine::Platform::createWindow ( const PlatformWindowDescriptor descriptor)
pure virtual

Creates a new platform window.

Parameters
descriptorA descriptor structure that describes the window to be created.
Returns
A newly created window instance.

Implemented in CeresEngine::EmscriptenPlatform, CeresEngine::iOSPlatform, CeresEngine::LinuxPlatform, CeresEngine::MacOSPlatform, and CeresEngine::Win32Platform.

◆ get()

static Platform & CeresEngine::Platform::get ( )
staticnoexcept

Gets the current platform. Assets if no platform was initialized.

◆ getLocalFileSystem()

virtual IFileSystem * CeresEngine::Platform::getLocalFileSystem ( ) const
virtual

Gets the underlying platform local file system implementation.

Note
Can be null in case the underlying platform doesn't expose a file system.
The default implementation returns nullptr. Platform implementors should override this method and return the local file system implementation of their platform.
Returns
A pointer to the platform local file system implementation.

Reimplemented in CeresEngine::ApplePlatform, CeresEngine::LinuxPlatform, CeresEngine::POSIXPlatform, and CeresEngine::Win32Platform.

◆ openFile()

virtual FileHandle CeresEngine::Platform::openFile ( const FilePath path) const
virtual

Opens a file on the local file system.

Note
Can be a null file handle in case the underlying platform don't expose a local file system. See getLocalFileSystem() for more information.
Parameters
pathThe path of the file to be opened.
Returns
A handle to to the file. The file may not exist, you must check with FileHandle::exists().

◆ run()

virtual void CeresEngine::Platform::run ( )
pure virtual

◆ stop()

virtual void CeresEngine::Platform::stop ( )
pure virtual

The documentation for this class was generated from the following file: