Skip to content

Namespace Engine

Namespace List > Engine

Namespaces

Type Name
namespace CollisionLayers
Namespace of collision layer helpers shared by ColliderComponent ,CollisionSystem , the editor Inspector and the Lua bindings.
namespace LuaAPI
namespace Multiplayer
namespace Network
namespace Signals
Godot-style signal dispatch shared by every emitter system.

Classes

Type Name
class AError
Base class for concrete Engine errors.
struct ActionBinding
All shortcuts bound to one action name, plus whether that action is sent to the server.
struct Animation
ECS Component managing animation clip collections and runtime playback state.
struct AnimationClip
Encapsulates static configuration data for a single animation state.
class AnimationPlugin
class AnimationSystem
System that updates animation frames and renders the current frame based onPosition .
class Application
The core framework of the engine. Owns the Registry and the Game Loop.
struct ApplicationConfig
Configuration passed to the engine when starting. Contains window settings and target framerate.
class AssetManager
Singleton class to load, store, and manage game audio assets.
class AudioPlugin
Bundles all audio-related resources, components, and systems for easy engine integration.
struct AudioSource
A pure ECS data component for triggering audio playback, when data is modified the audio will read to use using the Audio system.
class AudioSystem
A pure ECS System that processesAudioSource data components and maintains audio streams.
struct CameraComponent
2D camera that decides which part of the world is shown on screen.
class CameraPlugin
Plugin that bundles the CameraComponent andCameraSystem .
class CameraSystem
Moves cameras (follow, shake) and converts them into raylib cameras for rendering.
struct ColliderComponent
2D Axis-aligned bounding box collider integrated with Raylib Rectangle.
class ColliderPlugin
Bundles collider data, collision events, and CollisionSystem .
struct CollisionEvents
Per-entity callbacks for collision lifetime (Unity / Godot style).
class CollisionSystem
Detects overlaps between colliders using Raylib and fires enter/stay/exit events.
class ComponentArray <typename T>
Template class that stores a specific type of component for entities.
struct ComponentExample
A simple example component that stores raw data.
class Controller
Controller implementation polling Raylib keyboard, mouse, and gamepad inputs.
struct EditorMode
Registry marker meaning "this registry is being edited, not played".
struct EntityBounds
class ErrorAsset
Exception thrown when an asset cannot be loaded, found, or used.
class ErrorEcs
Exception thrown when ECS invariants are violated (missing component, resource, etc.).
struct FrameData
Represents an individual frame rectangle in a spritesheet and optional pivot offset.
class HierarchyPlugin
Registers Parent andHierarchySystem for parent-child hierarchies.
class HierarchySystem
Propagates parent Position deltas to relative children each frame.
class IComponentArray
Interface for component arrays so they can be stored generically.
class IController
Abstract interface representing a player's input controller (keyboard, mouse, gamepad, network).
class IError
Abstract base interface for all Engine exceptions.
class IPlugin
Interface for plugins.
struct Input
Component linking an entity to a specific player's controller.
class InputManager
Central input management resource storing and updating player controllers.
class InputPlugin
Bundles the Input component andInputManager resource into the ECS registry.
struct Keybind
Binding descriptor mapping a physical button/key to an action.
struct LaunchOptions
Command-line arguments handed to the game for things like launching a client or a server.
class LayeredRenderSystem
A system that draws entities one at a time, so RenderScene can mix them with the entities of other layered systems, sorted byPosition::z .
class LogBuffer
Process-wide ring of the most recent user error messages.
struct LogEntry
One stored log line. The display tag is added by the reader.
class LogWriter
Single consumer of terminal log lines.
struct LuaBinder
Extra Lua modules registered on the shared script state.
class MultiplayerSystem
class Music
Engine wrapper for audio streaming (long tracks). Cannot be cloned.
struct Name
A human-readable name for an entity (e.g. "Player", "Enemy").
struct NetworkComponent
Declarative networking metadata for a replicated entity.
struct NextState <typename T>
struct Opacity
Per-entity transparency multiplier applied at render time.
class OpacityPlugin
struct Parent
Links an entity to its parent in a transform hierarchy.
class PluginExample
A template plugin demonstrating how to bundle Data + Logic + Events.
struct PluginExampleEvents
Holds user-defined callbacks (hooks) for this specific entity. Functions exactly like Godot Signals or Unity Events.
struct Position
A basic component representing a 2D position (x, y) plus a draw layer (z).
class PositionPlugin
An example plugin that bundles the Position component andPositionSystem .
class PositionSystem
A system that updates the Position component of entities.
struct PrefabInstance
Marks the root of a subtree that was saved as or spawned from a .prefab .
struct PrefabSpawner
Runtime prefab instantiation hook.
struct ProjectContext
Per-registry project root used to resolve relative asset paths.
struct QuitRequest
Registry resource askingApplication to stop its loop.
class Registry
The core of the ECS. Manages entities, components, and systems.
struct Rotation
Component representing a 2D rotation.
class RotationPlugin
class SceneManager
Switches between scenes while the game runs.
struct ScreenSpace
Tag component: the entity is drawn in screen pixels, ignoring the camera.
struct ScriptComponent
Component that attaches a Lua script to an entity.
class ScriptPlugin
Registers ScriptComponent andScriptSystem with the registry.
class ScriptSystem
Updates all entities with a ScriptComponent by calling their Lua onUpdate(dt) function.
struct ShapeComponent
class ShapePlugin
Plugin that bundles the ShapeComponent andShapeSystem .
class ShapeSystem
System that rendersShapeComponent based onPosition .
struct SignalConnection
Godot-style connection: when emitter fires signal , callmethod ontarget 's script table as`method(table, emitter,
other)` .
struct SignalConnections
All outgoing connections of one emitter entity.
class SignalPlugin
Registers the SignalConnections component for Godot-style signal connections (Component.connect in Lua, Connections section in the editor Inspector).
class Sound
Engine wrapper for audio.
class Sprite
Engine wrapper for a visual sprite, utilizing raylib::Texture to handle rendering, scaling, and rotation.
struct SpriteComponent
Component that holds a Sprite to be rendered.
class SpritePlugin
Plugin that bundles the SpriteComponent andSpriteSystem .
class SpriteSystem
System that drawsSpriteComponent based onPosition .
struct State <typename T>
struct StateTransitionEvent <typename T>
class StatesSystem <typename T>
System responsible for applying state transitions.
class System
Base class for all systems in the engine.
class SystemExample
A simple example system that modifies ComponentExample and fires EventsExample.
struct Text
Component representing 2D renderable text in the ECS.
class TextPlugin
Bundles Text component registration andTextSystem into the ECS.
class TextSystem
Renders 2D text elements for entities possessing both Text andPosition .
struct UiPass
Optional overlay drawn in window space after the letterboxed canvas.
class VirtualResolution
Fixed-size game canvas, scaled and centered into the OS window.
struct WaveConfig
struct WaveDefinition
One enemy wave configured from the visual editor.
class WavePlugin
Plugin that bundles the scene wave spawner system.
struct WaveSchedule
Registry resource holding the scene's waves and their runtime state.
class WaveSpawnerSystem
Spawns scene waves from the WaveSchedule resource.

Public Types

Type Name
typedef std::string Action
enum DeviceType
Input device categories.
typedef std::size_t Entity
Type definition for an Entity .
enum LogAudience
Who a log line is for.
enum LogLevel
Severity of one log line.
enum ShapeType
enum WavePatternType
enum error_severity_e
Severity level attached to an Engine error.

Public Attributes

Type Name
std::array< std::string_view, 6 > kCollisionSignals = /* multi line expression */
Collision/trigger signal names emitted by CollisionSystem .

Public Functions

Type Name
void EnqueueLog (LogLevel level, std::string message)
Queues message , or writes it directly when the worker is gone.
bool FlipEntityX (Registry & registry, Entity entity)
Mirrors an entity rig horizontally, about its own centre.
std::string GetEntityName (Registry & registry, Entity entity)
Returns the display name of an entity.
EntityBounds GetEntitySize (Registry & registry, Entity entity)
Retrieves the size (width, height) and offset of an entity.
LogBuffer & GetLogBuffer ()
The user-error ring used by emit and the Editor console.
bool IsKnownSignal (std::string_view signal)
True when signal is a signal the engine can emit.
void RenderScene (Registry & registry, float viewportWidth, float viewportHeight, const std::function< void()> & worldOverlay=nullptr, std::optional< Camera2D > cameraOverride=std::nullopt, std::optional< Camera2D > screenCameraOverride=std::nullopt)
Draws every system in two passes onto the current render target.
std::filesystem::path ResolveAssetPath (Registry & registry, const std::string & path)
Resolves a stored (usually project-relative) path to a loadable one.
std::filesystem::path ResolveProjectPath (Registry & registry, const std::string & path)
Legacy alias kept for Windows-branch call sites.
void SetTerminalLogToStderr ()
Sends every terminal log line to stderr.
void ShutdownLogging ()
Joins the terminal worker. Called at the end of Application shutdown. Later calls are a no-op.
std::vector< Entity > SpawnWaveFormation (Registry & registry, const WaveConfig & config)
Spawns a wave formation according to the provided configuration.
std::string ToProjectRelativePath (Registry & registry, const std::string & path)
Converts an absolute (or foreign) path to project-relative form for storage in committed files. Paths outside the project are left as-is.
void WriteLogLine (LogLevel level, const std::string & message)
Writes one tagged line and flushes that stream.
void emit (LogLevel level, LogAudience audience, std::string msg)
Single write path for all log levels.
void log_debug (std::string msg)
void log_error (std::string msg)
void log_info (std::string msg)
void log_user_error (std::string msg)
Records one user-caused error.
void registerWave (sol::state_view lua, Registry & registry)

Public Types Documentation

typedef Action

using Engine::Action =  std::string;

enum DeviceType

Input device categories.

enum Engine::DeviceType {
    KEYBOARD,
    MOUSE,
    GAMEPAD,
    TOUCH
};


typedef Entity

Type definition for an Entity .

using Engine::Entity =  std::size_t;


enum LogAudience

Who a log line is for.

enum Engine::LogAudience {
    Engine,
    User
};

Engine lines go to the terminal only. User lines are also stored for the editor Console.


enum LogLevel

Severity of one log line.

enum Engine::LogLevel {
    Error,
    Debug,
    Info
};

Shared by the terminal writer and the in-memory ring buffer so both stay in sync.


enum ShapeType

enum Engine::ShapeType {
    RECTANGLE,
    CIRCLE,
    POLYGON,
    LINE
};

enum WavePatternType

enum Engine::WavePatternType {
    Line,
    VFormation,
    Sine,
    Grid,
    Custom
};

enum error_severity_e

Severity level attached to an Engine error.

enum Engine::error_severity_e {
    LOW,
    MODERATE,
    CRITICAL,
    FATAL
};


Public Attributes Documentation

variable kCollisionSignals

Collision/trigger signal names emitted by CollisionSystem .

std::array<std::string_view, 6> Engine::kCollisionSignals;

These double as the Godot-style signal vocabulary for connections: an emitter with a Collider fires the onCollision* signals on every contact and additionally the onTrigger* ones when either party is a trigger.


Public Functions Documentation

function EnqueueLog

Queues message , or writes it directly when the worker is gone.

void Engine::EnqueueLog (
    LogLevel level,
    std::string message
) 

Parameters:

  • level Severity stored with the line.
  • message Raw message. Moved from.

function FlipEntityX

Mirrors an entity rig horizontally, about its own centre.

bool Engine::FlipEntityX (
    Registry & registry,
    Entity entity
) 

The entity's own sprite flip is toggled, so the art faces the other way, and every descendant's footprint is reflected about the same vertical line, so attachments - a front sensor, a weapon mount - swap sides while keeping their distance from their parent. Reflection uses footprints rather than anchors because positions are top-left corners in this engine: mirroring the anchor of a box that grows rightwards would leave it on the wrong side of its parent.

This is the implementation behind the Component.flipX Lua binding. It is a toggle, so call it once per direction change.

Parameters:

  • registry ECS registry holding the entity and its subtree.
  • entity Root of the rig to mirror.

Returns:

false when entity is not alive or has no Position; the registry is left untouched in that case.


function GetEntityName

Returns the display name of an entity.

inline std::string Engine::GetEntityName (
    Registry & registry,
    Entity entity
) 

Parameters:

  • registry The registry holding the entity.
  • entity The entity for which to get the name.

Returns:

The entity's Name, or "Entity X" if it has none.


function GetEntitySize

Retrieves the size (width, height) and offset of an entity.

EntityBounds Engine::GetEntitySize (
    Registry & registry,
    Entity entity
) 

The function first checks for a ColliderComponent with a rectangle shape. If none is found, it falls back to the SpriteComponent source rectangle and scale. If both are missing, a default size of 64x64 is returned.


function GetLogBuffer

The user-error ring used by emit and the Editor console.

LogBuffer & Engine::GetLogBuffer () 


function IsKnownSignal

True when signal is a signal the engine can emit.

inline bool Engine::IsKnownSignal (
    std::string_view signal
) 


function RenderScene

Draws every system in two passes onto the current render target.

void Engine::RenderScene (
    Registry & registry,
    float viewportWidth,
    float viewportHeight,
    const std::function< void()> & worldOverlay=nullptr,
    std::optional< Camera2D > cameraOverride=std::nullopt,
    std::optional< Camera2D > screenCameraOverride=std::nullopt
) 

  • World pass, inside the active camera.
  • Screen pass, in plain pixels (HUD): entities tagged with ScreenSpace.

In each pass, the entities of every LayeredRenderSystem (sprites, shapes, text) are drawn first, sorted by Position::z (higher z on top), then by system registration order ( Registry::GetSystemRenderOrder), then by entity id. After that, each system's Render() / RenderScreen() runs in registration order, for systems that draw on their own. Shared by the game loop and the Editor scene view so both draw the same thing. Does not call BeginDrawing/EndDrawing nor clear the background.

Parameters:

  • registry The ECS registry.
  • viewportWidth Width in pixels of the surface being drawn to.
  • viewportHeight Height in pixels of the surface being drawn to.
  • worldOverlay Optional extra world-space drawing done after the systems, still inside the camera.
  • cameraOverride Optional camera used instead of the active one for the world pass.
  • screenCameraOverride Optional camera applied to the screen-space pass, so callers drawing to a surface larger than the canvas (the Editor scene view) can preview the HUD where the game would show it. Omitted => HUD drawn in plain pixels, as at runtime.

function ResolveAssetPath

Resolves a stored (usually project-relative) path to a loadable one.

inline std::filesystem::path Engine::ResolveAssetPath (
    Registry & registry,
    const std::string & path
) 

Returns:

The absolute path unchanged when it exists, otherwise the path joined onto the project folder (existing or not, so callers can report the attempted location), otherwise the input unchanged.


function ResolveProjectPath

Legacy alias kept for Windows-branch call sites.

inline std::filesystem::path Engine::ResolveProjectPath (
    Registry & registry,
    const std::string & path
) 

See also: ResolveAssetPath


function SetTerminalLogToStderr

Sends every terminal log line to stderr.

void Engine::SetTerminalLogToStderr () 

MCP mode keeps stdout for JSON-RPC. Call this before the first log. INFO and DEBUG stay tagged; only the stream changes.


function ShutdownLogging

Joins the terminal worker. Called at the end of Application shutdown. Later calls are a no-op.

void Engine::ShutdownLogging () 


function SpawnWaveFormation

Spawns a wave formation according to the provided configuration.

std::vector< Entity > Engine::SpawnWaveFormation (
    Registry & registry,
    const WaveConfig & config
) 

The function creates "count" entities using the PrefabSpawner resource, positions them according to the selected pattern, and optionally creates a parent entity that groups them together.

Returns:

Vector of spawned entity IDs.


function ToProjectRelativePath

Converts an absolute (or foreign) path to project-relative form for storage in committed files. Paths outside the project are left as-is.

inline std::string Engine::ToProjectRelativePath (
    Registry & registry,
    const std::string & path
) 


function WriteLogLine

Writes one tagged line and flushes that stream.

void Engine::WriteLogLine (
    LogLevel level,
    const std::string & message
) 

Parameters:

  • level Selects std::cerr for errors and std::cout otherwise, unless SetTerminalLogToStderr was called.
  • message Raw message, without the terminal tag.

Used by the worker's direct fallback and by the web build. Not a call-site API.


function emit

Single write path for all log levels.

inline void Engine::emit (
    LogLevel level,
    LogAudience audience,
    std::string msg
) 

User lines are copied into LogBuffer, then every line is moved to the terminal queue. The caller does not touch std::cout or std::cerr. Call sites stay on the log_* macros.

Parameters:

  • level Severity of the line.
  • audience Engine lines stay on the terminal. User lines also reach the Console.
  • msg Raw message, without the terminal tag.

function log_debug

inline void Engine::log_debug (
    std::string msg
) 

function log_error

inline void Engine::log_error (
    std::string msg
) 

function log_info

inline void Engine::log_info (
    std::string msg
) 

function log_user_error

Records one user-caused error.

inline void Engine::log_user_error (
    std::string msg
) 

The line is shown in the editor Console and written to the terminal. Use this when the failure comes from content or input the user controls.

Parameters:

  • msg Raw message, without the terminal tag.

function registerWave

void Engine::registerWave (
    sol::state_view lua,
    Registry & registry
) 

Registers the Wave API in the provided Lua state.

Parameters:

  • lua The sol::state_view representing the Lua interpreter.
  • registry Reference to the Engine registry for component access.


The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Assets/AssetManager.hpp