Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
Muto::Layer Class Reference

Represents a reusable application layer that receives lifecycle callbacks (attach, detach, update, events, render, and ImGui render). Intended as a base class for concrete layers. More...

#include <Layer.h>

Inheritance diagram for Muto::Layer:
ExampleLayer ExampleLayer Muto::EditorLayer Muto::ImGuiLayer Sandbox2D Muto::OpenGLImGuiLayer

Public Member Functions

const std::string & GetName () const
 Retrieves the name of the layer for debugging purposes.
 
 Layer (const std::string &name="Layer")
 Constructs a Layer with an optional name for debugging purposes.
 
virtual void OnAttach ()
 Called when the layer is attached to the application.
 
virtual void OnDetach ()
 Called when the layer is detached from the application.
 
virtual void OnEvent (Event &event)
 Called when an event is dispatched to the layer.
 
virtual void OnImGuiRender ()
 Called when the layer should render its ImGui components.
 
virtual void OnRender ()
 Called when the layer should render its contents.
 
virtual void OnUpdate (Timestep ts)
 Called every frame to update the layer with the given timestep.
 
virtual ~Layer ()
 

Protected Attributes

std::string m_DebugName
 The name of the layer assigned at creation, used for debugging.
 

Detailed Description

Represents a reusable application layer that receives lifecycle callbacks (attach, detach, update, events, render, and ImGui render). Intended as a base class for concrete layers.

Constructor & Destructor Documentation

◆ Layer()

Muto::Layer::Layer ( const std::string &  name = "Layer")

Constructs a Layer with an optional name for debugging purposes.

Parameters
nameThe name of the layer, used for debugging, defaulted to "Layer".
8 {
9 }
std::string m_DebugName
The name of the layer assigned at creation, used for debugging.
Definition Layer.h:57
constexpr Scope< T > CreateScope(Args &&... args)
Creates a Scope (unique_ptr) for the given type and constructor arguments.
Definition Defines_Macros.h:51

References m_DebugName.

◆ ~Layer()

Muto::Layer::~Layer ( )
virtual
12 {
13 }

Member Function Documentation

◆ GetName()

const std::string & Muto::Layer::GetName ( ) const
inline

Retrieves the name of the layer for debugging purposes.

53{ return m_DebugName; }

References m_DebugName.

◆ OnAttach()

virtual void Muto::Layer::OnAttach ( )
inlinevirtual

Called when the layer is attached to the application.

Reimplemented in Muto::EditorLayer, Muto::ImGuiLayer, Muto::OpenGLImGuiLayer, and Sandbox2D.

28{};

Referenced by Muto::Application::PushLayer(), and Muto::Application::PushOverlay().

◆ OnDetach()

virtual void Muto::Layer::OnDetach ( )
inlinevirtual

Called when the layer is detached from the application.

Reimplemented in Muto::EditorLayer, Muto::ImGuiLayer, Muto::OpenGLImGuiLayer, and Sandbox2D.

31{};

◆ OnEvent()

virtual void Muto::Layer::OnEvent ( Event &  event)
inlinevirtual

Called when an event is dispatched to the layer.

Parameters
eventThe event being dispatched.

Reimplemented in Muto::EditorLayer, Muto::ImGuiLayer, Muto::OpenGLImGuiLayer, Sandbox2D, ExampleLayer, and ExampleLayer.

41{}

◆ OnImGuiRender()

virtual void Muto::Layer::OnImGuiRender ( )
inlinevirtual

Called when the layer should render its ImGui components.

Reimplemented in Muto::EditorLayer, Muto::ImGuiLayer, Muto::OpenGLImGuiLayer, Sandbox2D, ExampleLayer, and ExampleLayer.

50{};

◆ OnRender()

virtual void Muto::Layer::OnRender ( )
inlinevirtual

Called when the layer should render its contents.

Note
Layers are responsible for their own rendering needs.
Todo:
add layer rendering into the application's render loop
47{};

◆ OnUpdate()

virtual void Muto::Layer::OnUpdate ( Timestep  ts)
inlinevirtual

Called every frame to update the layer with the given timestep.

Parameters
tsThe timestep representing the time elapsed since the last update.

Reimplemented in Sandbox2D, ExampleLayer, ExampleLayer, and Muto::EditorLayer.

36{};

Member Data Documentation

◆ m_DebugName

std::string Muto::Layer::m_DebugName
protected

The name of the layer assigned at creation, used for debugging.

Referenced by GetName(), and Layer().


The documentation for this class was generated from the following files: