Platform

Platform-specific window creation and management utilities.

Overview

Typical use cases:

  • Creating and destroying windows in a platform-agnostic manner.

Header

<RaeptorCogs/Platform.hpp>

Metadata

Author

Estorc

Version

v1.0

Copyright

Copyright (c) 2025 Estorc MIT License.

Classes

Classes

Class

Description

RaeptorCogs::Singletons::Platform

Platform singleton class.

class Platform

Platform singleton class.

Manages platform-specific window creation and management.

RaeptorCogs::Window* window = RaeptorCogs::Platform().createWindow(800, 600, "My Window");
// Use the window ...
RaeptorCogs::Platform().destroyWindow(window);

Public Functions

Window *createWindow(int width, int height, const std::string_view &title)

Create a new window with the specified dimensions and title.

RaeptorCogs::Window* window = RaeptorCogs::Renderer().createWindow(800, 600, "My Window");

Note

The created window is managed by the renderer.

Parameters:
  • width – The width of the window.

  • height – The height of the window.

  • title – The title of the window.

Returns:

Pointer to the created window.

void destroyWindow(Window *window)

Destroy the specified window.

Note

The window is removed from the renderer’s management.

Parameters:

window – Pointer to the window to be destroyed.

inline std::vector<Window*> &getWindows()

Get the list of managed windows.

Note

Used for accessing all windows created by the platform.

Returns:

Reference to the vector of managed windows.

inline void setRenderer(Renderer *renderer)

Set the renderer singleton.

Parameters:

renderer – Pointer to the renderer singleton.

inline Renderer *getRenderer() const

Get the renderer singleton.

Returns:

Pointer to the renderer singleton.

~Platform()

Destructor for the Platform singleton.

Cleans up all managed windows.

Private Members

Renderer *renderer = nullptr

Pointer to the renderer singleton.

Used for window creation and management.

std::vector<Window*> windows

List of managed windows.

The renderer manages multiple windows for rendering.

friend SingletonAccessor< Platform >