Documentation Index
Fetch the complete documentation index at: https://mintlify.com/raoulkdev/MiniECS/llms.txt
Use this file to discover all available pages before exploring further.
MiniECS::Module is the abstract base class for all components in the MiniECS framework. Every piece of per-Unit behaviour — rendering, transformation, physics, custom logic — is implemented by subclassing Module and overriding the start() method. Modules are owned by Units via std::unique_ptr and are created through Unit::addModule().
Namespace & Header
Constructor
ModuleType enum value in the private type field and derives a human-readable string name from it via an internal switch statement. The resolved names are:
ModuleType | Resolved moduleTypeName |
|---|---|
ModuleType::ModuleBase | "ModuleBase" |
ModuleType::Transform | "Transform" |
ModuleType::Renderer | "Renderer" |
| (unrecognised) | "Unknown" |
"Added <typeName>" to stdout.
The type identifier for this Module instance. Determines the value returned by
getType() and getTypeName() for the lifetime of the object. See ModuleType for all valid values.Destructor
"Removed <typeName>" to stdout when the Module is destroyed. The destructor is virtual to ensure correct cleanup when a Module* or unique_ptr<Module> pointing to a derived class instance is destroyed.
Example
start
Unit::callModuleStart() as part of the World::play() game loop. The base implementation prints "Start / Start module" to stdout. Override this method in your derived classes to implement custom per-frame behaviour.
Example — base class behaviour
getType
ModuleType enum value that was passed to the constructor. Used internally by Unit::addModule() and Unit::removeModule() for duplicate detection and targeted removal.
Returns: ModuleType — the type identifier of this Module instance.
Example
getTypeName
ModuleType at construction time. Useful for logging and debugging.
Returns: std::string — the human-readable type name, e.g. "Transform", "Renderer", or "ModuleBase".
Example
Private Members
The following private fields are set at construction and accessed only via the public methods above:| Field | Type | Description |
|---|---|---|
type | ModuleType | The enum value identifying this Module’s type. |
moduleTypeName | std::string | Human-readable name resolved from type at construction. |
Built-in Derived Classes
MiniECS ships with two concrete Module subclasses. Both inherit theModule constructor via using Module::Module and override start().
TransformModule
TransformModule stores 2D spatial data for a Unit and prints that data to stdout on every start() call. It exposes three public glm::vec2 fields.
start() is called, it prints:
RendererModule
RendererModule is a minimal rendering lifecycle hook. Its start() override prints "Start / Started rendering..." to stdout each frame. See the full reference at RendererModule.
Both
TransformModule and RendererModule are added to a Unit via Unit::addModule() using their corresponding ModuleType values — you do not construct them directly. Use Unit::getModule<T>() to retrieve a typed pointer after adding them.