KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::Layer Class Referenceabstract

Base class of all Karma's Layers. For instance KarmaGuiLayer. More...

#include <Layer.h>

Inheritance diagram for Karma::Layer:

Public Member Functions

 Layer (const std::string &name="Layer")
 A constructor.
 
virtual ~Layer ()
 A destructor.
 
virtual void OnAttach ()=0
 A function called on Layer when the Layer is pushed or OverLay is pushed.
 
virtual void OnDetach ()=0
 A function called on Layer when the LayerStack is destroyed.
 
virtual void OnUpdate (float deltaTime)=0
 Function called in each game loop.
 
virtual void KarmaGuiRender (float deltaTime)=0
 Function called in each game loop, specifically for rendering purposes.
 
virtual void OnEvent (Event &event)
 For dispatching Events specific to the Layer.
 
const std::string & GetName () const
 Getter for the name of the Layer (debugging purposes).
 

Protected Attributes

std::string m_DebugName
 

Detailed Description

Base class of all Karma's Layers. For instance KarmaGuiLayer.

Constructor & Destructor Documentation

◆ Layer()

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

A constructor.

Since
Karma 1.0.0

◆ ~Layer()

Karma::Layer::~Layer ( )
virtual

A destructor.

Since
Karma 1.0.0

Member Function Documentation

◆ GetName()

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

Getter for the name of the Layer (debugging purposes).

Since
Karma 1.0.0

◆ KarmaGuiRender()

virtual void Karma::Layer::KarmaGuiRender ( float deltaTime)
pure virtual

Function called in each game loop, specifically for rendering purposes.

This is part of KarmaGui rendering sequence, thus different from OnUpdate().

See also
Application::Run()
Since
Karma 1.0.0

Implemented in ExampleLayer, Karma::EditorLayer, and Karma::KarmaGuiLayer.

◆ OnAttach()

virtual void Karma::Layer::OnAttach ( )
pure virtual

A function called on Layer when the Layer is pushed or OverLay is pushed.

See also
Application::PushLayer, Application::PushOverlay
Since
Karma 1.0.0

Implemented in ExampleLayer, Karma::EditorLayer, and Karma::KarmaGuiLayer.

◆ OnDetach()

virtual void Karma::Layer::OnDetach ( )
pure virtual

A function called on Layer when the LayerStack is destroyed.

See also
LayerStack::~LayerStack()
Since
Karma 1.0.0

Implemented in ExampleLayer, Karma::EditorLayer, and Karma::KarmaGuiLayer.

◆ OnEvent()

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

For dispatching Events specific to the Layer.

Note
GLFW calls the Application::OnEvent which further calls the OnEvent function in the subsequent layers and, depending on m_Handled, the depth of the call chain (measured in the sense of for-loop, upon the ordered layers) is determined.
Since
Karma 1.0.0

Reimplemented in ExampleLayer, Karma::EditorLayer, and Karma::KarmaGuiLayer.

◆ OnUpdate()

virtual void Karma::Layer::OnUpdate ( float deltaTime)
pure virtual

Function called in each game loop.

Parameters
deltaTimeThe time step (or interval) gap between two consecutive calls (previous single loop iteration time)
See also
Application::Run()
Since
Karma 1.0.0

Implemented in ExampleLayer, Karma::EditorLayer, and Karma::KarmaGuiLayer.


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