Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine.
GitHub | Vesper Updates | Creator
Loading...
Searching...
No Matches
Vesper::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 Vesper::Layer:
Vesper::EditorLayer Vesper::ImGuiLayer Vesper::OpenGLImGuiLayer

Public Member Functions

 Layer (const std::string &name="Layer")
 Constructs a Layer with an optional name for debugging purposes.
virtual ~Layer ()
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 OnUpdate (Timestep ts)
 Called every frame to update the layer with the given timestep.
virtual void OnEvent (Event &event)
 Called when an event is dispatched to the layer.
virtual void OnRender ()
 Called when the layer should render its contents.
virtual void OnImGuiRender ()
 Called when the layer should render its ImGui components.
const std::string & GetName () const
 Retrieves the name of the layer for debugging purposes.

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()

Vesper::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".
7 : m_DebugName(name)
8 {
9 }
std::string m_DebugName
The name of the layer assigned at creation, used for debugging.
Definition Layer.h:57

References Layer().

Referenced by Layer().

◆ ~Layer()

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

Member Function Documentation

◆ GetName()

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

Retrieves the name of the layer for debugging purposes.

53{ return m_DebugName; }

◆ OnAttach()

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

Called when the layer is attached to the application.

Reimplemented in Vesper::EditorLayer, Vesper::ImGuiLayer, and Vesper::OpenGLImGuiLayer.

28{};

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

◆ OnDetach()

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

Called when the layer is detached from the application.

Reimplemented in Vesper::EditorLayer, Vesper::ImGuiLayer, and Vesper::OpenGLImGuiLayer.

31{};

◆ OnEvent()

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

Called when an event is dispatched to the layer.

Parameters
eventThe event being dispatched.

Reimplemented in Vesper::EditorLayer, Vesper::ImGuiLayer, and Vesper::OpenGLImGuiLayer.

41{}

◆ OnImGuiRender()

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

Called when the layer should render its ImGui components.

Reimplemented in Vesper::EditorLayer, Vesper::ImGuiLayer, and Vesper::OpenGLImGuiLayer.

50{};

◆ OnRender()

virtual void Vesper::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 Vesper::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 Vesper::EditorLayer.

36{};

Member Data Documentation

◆ m_DebugName

std::string Vesper::Layer::m_DebugName
protected

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


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