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 base class for all behaviour components in MiniECS. Every piece of per-frame logic — rendering, physics, gameplay — is expressed as a Module subclass attached to a Unit. This maps directly to the Unity Component model: just as you add a Rigidbody or MeshRenderer component to a GameObject, you add a TransformModule or RendererModule to a Unit. The key entry point is the virtual start() method, which the World’s game loop calls once per tick on every attached Module.
Class Overview
Module stores two identifying values: a ModuleType enum entry and a human-readable moduleTypeName string. Both are set in the constructor based on the setType argument, using a switch statement that maps enum values to strings ("ModuleBase", "Transform", "Renderer").
Constructor
ModuleType enum value. It assigns type, derives moduleTypeName from a switch, and prints "Added <typeName>" to stdout. You do not call this constructor directly — Unit::addModule() calls it when constructing a concrete subclass.
"Removed <typeName>" to stdout when the Module is destroyed (e.g. when removeModule() is called or the owning Unit is destroyed).
Key Methods
start()
Unit::callModuleStart() once per frame tick during the game loop. The base implementation prints "Start / Start module\n" to stdout. Override it in a subclass to provide real behaviour.
getType()
ModuleType enum value stored in this Module. Used by Unit::addModule() to detect duplicates and by Unit::removeModule() to locate the correct entry for erasure.
getTypeName()
ModuleType — for example "Transform" or "Renderer". Useful for logging and debugging.
Extending Module
To create a custom Module, subclassModule, inherit its constructor with using Module::Module;, and override start().
Update the constructor switch
Add a case in
Module.cpp so the constructor sets the correct moduleTypeName:Built-in Derived Classes
MiniECS ships with two concrete Module implementations.TransformModule
Stores GLMvec2 fields for position, rotation, and scale. Its start() override prints the current transform state to stdout every frame.
RendererModule
A minimal rendering stub whosestart() override prints "Start / Started rendering..." each frame.
Further Reading
Custom Module Guide
Full walkthrough of creating, registering, and using a custom Module type.
TransformModule
Position, rotation, and scale fields plus per-frame state output.
RendererModule
Built-in rendering stub and how to extend it.