Skip to content

Creating a Custom Layer

renanbomtempo edited this page Jun 10, 2026 · 1 revision

⚠️ This wiki is under construction. Pages are being populated incrementally.

Creating a Custom Layer

This tutorial walks you through creating a custom layer from scratch — declaring the module, implementing the lifecycle methods, and integrating it with your application.

Prerequisites

Step 1: Declare the Module Interface

// MyLayer.cppm
export module MyApp.MyLayer;

import Nodens;

export class MyLayer : public Nodens::Layer {
public:
    MyLayer();
    void OnAttach() override;
    void OnDetach() override;
    void OnUpdate(Nodens::TimeStep ts) override;
    void OnImGuiRender(Nodens::TimeStep ts) override;
    void OnEvent(Nodens::Event& event) override;

private:
    // Your state here
};

Step 2: Implement the Layer

// MyLayer.cpp
module MyApp.MyLayer;

// Implementation here...

Step 3: Register with CMake

Step 4: Push the Layer

Step 5: Build and Run

Full Working Example

See Also

Clone this wiki locally