Skip to main content

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.

RendererModule is the built-in rendering component in MiniECS. In its current form it serves as a lifecycle hook that demonstrates how a Module participates in the scene’s update loop — when start() is called it prints a single line to stdout confirming that rendering has started. It is intentionally minimal, giving you a clean foundation to build real rendering logic on top of.

Class Definition

RendererModule inherits from Module and overrides only start(). Like all built-in modules, it forwards construction to the base class via using Module::Module.
class RendererModule : public Module {
public:
    using Module::Module;
    void start() override;
};

The start() Override

When start() is called, it writes a single confirmation line to stdout:
Start / Started rendering...
This is the integration point for your own rendering logic. Replace or extend this method in a subclass to call into a graphics API, submit draw calls, or coordinate with other modules on the same Unit.

Attaching RendererModule to a Unit

Pass MiniECS::ModuleType::Renderer to addModule on any Unit pointer. The module is constructed and owned by the Unit for the lifetime of the scene.
unit->addModule(MiniECS::ModuleType::Renderer);
When working with a named Unit in a scene, the typical pattern is:
scene.getUnitByName("u1")->addModule(MiniECS::ModuleType::Renderer);

Retrieving RendererModule

Use getModule<MiniECS::RendererModule>() to obtain a typed pointer to the attached RendererModule. Always check for nullptr before use — the module may not be attached.
auto* renderer = unit->getModule<MiniECS::RendererModule>();
if (renderer) {
    // use renderer
}

Expected Output

When the scene is played and start() is called, RendererModule produces the following line:
Start / Started rendering...

Extending RendererModule

RendererModule is intentionally minimal. It exists as a starting point for your own rendering logic rather than a fully featured renderer. Override start() in a subclass to add draw calls or API integration, or extend the ModuleType enum and create a new Module class for richer, purpose-built functionality.
For a step-by-step walkthrough of building a Module with real rendering logic — including how to register a custom ModuleType and wire it into the scene loop — see the Custom Module guide.

Build docs developers (and LLMs) love