RaeptorCogs

Main RaeptorCogs library header.

Overview

Typical use cases:

  • Including all RaeptorCogs functionalities in a single header

  • Accessing core engine features such as rendering, resource management, input handling, and timing

Header

<RaeptorCogs/RaeptorCogs.hpp>

Metadata

Author

Estorc

Version

v1.0

Copyright

Copyright (c) 2025 Estorc MIT License.

Functions

Functions

Function

Description

RaeptorCogs::Destroy()

Destroy the RaeptorCogs engine and clean up resources.

RaeptorCogs::GetScreenHeight()

Get the current screen height.

RaeptorCogs::GetScreenWidth()

Get the current screen width.

RaeptorCogs::Initialize()

Initialize the RaeptorCogs engine.

RaeptorCogs::Input()

Access the global Input singleton.

RaeptorCogs::IsExiting()

Check if the application is exiting.

RaeptorCogs::MainLoop(std::function< void(Window &)> updateFunction, Window &window)

Main application loop.

RaeptorCogs::MainWorker()

Access the global MainWorker singleton.

RaeptorCogs::Mouse()

Access the global Mouse singleton.

RaeptorCogs::Platform()

Access the global Platform singleton.

RaeptorCogs::Random()

Access the global Random singleton.

RaeptorCogs::Renderer()

Access the global Renderer singleton.

RaeptorCogs::ResourceManager()

Access the global ResourceManager singleton for a specific resource type.

RaeptorCogs::ResourceWorker()

Access the global ResourceWorker singleton.

RaeptorCogs::StartLoop(std::function< void(Window &)> updateFunction, Window &window)

Start the main application loop.

RaeptorCogs::TextureAtlasManager()

Access the global TextureAtlasManager singleton.

RaeptorCogs::Time()

Access the global Time singleton.

RaeptorCogs::exitHandler()

No description.

void RaeptorCogs::Destroy()

Destroy the RaeptorCogs engine and clean up resources.

RaeptorCogs::Destroy();
double RaeptorCogs::GetScreenHeight()

Get the current screen height.

double height = RaeptorCogs::GetScreenHeight();

Returns:

Current screen height in pixels.

double RaeptorCogs::GetScreenWidth()

Get the current screen width.

double width = RaeptorCogs::GetScreenWidth();

Returns:

Current screen width in pixels.

void RaeptorCogs::Initialize()

Initialize the RaeptorCogs engine.

Sets up necessary subsystems and prepares the engine for use.

RaeptorCogs::Initialize();
Singletons::Input &RaeptorCogs::Input()

Access the global Input singleton.

if (RaeptorCogs::Input().isKeyPressed(RaeptorCogs::Key::A)) {
    // 'A' key is currently pressed
}

Returns:

Reference to the Input singleton.

bool RaeptorCogs::IsExiting()

Check if the application is exiting.

if (RaeptorCogs::IsExiting()) {
    // Handle exiting logic
}

Returns:

true if the application is in the process of exiting, false otherwise.

void RaeptorCogs::MainLoop(std::function<void(Window&)> updateFunction, Window &window)

Main application loop.

Continuously calls the provided update function, processes input, and renders frames until the application exits.

Parameters:
  • updateFunction – Function to be called each frame for updates.

  • window – Pointer to the main application window.

Singletons::MainWorker &RaeptorCogs::MainWorker()

Access the global MainWorker singleton.

RaeptorCogs::MainWorker().addJob([](){
    // Job logic here
});

Returns:

Reference to the MainWorker singleton (Main thread).

Singletons::Mouse &RaeptorCogs::Mouse()

Access the global Mouse singleton.

if (RaeptorCogs::Mouse().isButtonPressed(RaeptorCogs::MouseButton::LEFT)) {
    // Left mouse button is currently pressed
}

Returns:

Reference to the Mouse singleton.

Singletons::Platform &RaeptorCogs::Platform()

Access the global Platform singleton.

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

Returns:

Reference to the Platform singleton.

Singletons::Random &RaeptorCogs::Random()

Access the global Random singleton.

int randInt = RaeptorCogs::Random().getInt(1, 10);

Returns:

Reference to the Random singleton.

Singletons::Renderer &RaeptorCogs::Renderer()

Access the global Renderer singleton.

auto &renderer = RaeptorCogs::Renderer();
renderer.render(window);

Returns:

Reference to the Renderer singleton.

template<typename T>
Singletons::ResourceManager<T> &RaeptorCogs::ResourceManager()

Access the global ResourceManager singleton for a specific resource type.

auto &textureManager = RaeptorCogs::ResourceManager<RaeptorCogs::Texture>();
Texture &tex = textureManager.get_or_create("path/to/texture.png");

Template Parameters:

T – The type of resource managed by the ResourceManager.

Returns:

Reference to the ResourceManager singleton for the specified resource type.

Worker &RaeptorCogs::ResourceWorker()

Access the global ResourceWorker singleton.

RaeptorCogs::ResourceWorker().addJob([](){
    // Job logic here
});

Returns:

Reference to the ResourceWorker singleton (Parallel thread).

void RaeptorCogs::StartLoop(std::function<void(Window&)> updateFunction, Window &window)

Start the main application loop.

RaeptorCogs::StartLoop([](RaeptorCogs::Window* mainWindow) {
    // Update logic here
}, mainWindow);

Parameters:
  • updateFunction – Function to be called each frame for updates.

  • window – Reference to the main application window.

Singletons::TextureAtlasManager &RaeptorCogs::TextureAtlasManager()

Access the global TextureAtlasManager singleton.

auto &atlasManager = RaeptorCogs::TextureAtlasManager();
auto atlas = atlasManager.getAtlas(someKey);

Returns:

Reference to the TextureAtlasManager singleton.

Singletons::Time &RaeptorCogs::Time()

Access the global Time singleton.

double deltaTime = RaeptorCogs::Time().getDeltaTime();

Returns:

Reference to the Time singleton.

static void RaeptorCogs::exitHandler()

Variables

static std::atomic<bool> RaeptorCogs::_exiting = false