QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
Quasar::Layer Class Reference

Part of an application that is updated, rendered and receives events. More...

#include <quasar/core/Layer.h>

Inheritance diagram for Quasar::Layer:
Quasar::ImGuiLayer

Public Member Functions

 Layer (const Layer &)=delete
Layer & operator= (const Layer &)=delete
 Layer (Layer &&)=delete
Layer & operator= (Layer &&)=delete
virtual void OnAttach ()
 Called once when the layer is added to the application, before any other hook.
virtual void OnDetach ()
 Called once when the layer is removed from the application, after every other hook.
virtual void OnUpdate (Timestep timestep)
 Called once per frame to update the layer.
virtual void OnRender ()
 Called once per frame, after OnUpdate(), to render the layer.
virtual void OnImGuiRender ()
 Called once per frame, after OnRender(), to draw the ImGui windows of the layer.
virtual void OnEvent (Event &event)
 Called for each event received by the layer.
const std::string & GetName () const
 Returns the name of the layer, for debugging.

Protected Member Functions

 Layer (std::string name="Layer")
 Creates a layer with a name, used in logs and debugging tools.

Detailed Description

Part of an application that is updated, rendered and receives events.

An application is made of layers, for example the game scene, then the editor panels on top of it. Each layer derives from this class and only overrides the hooks it needs: all of them do nothing by default.

A layer cannot be copied or moved, because the application keeps it at the same address while it is attached.

Member Function Documentation

◆ OnAttach()

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

Called once when the layer is added to the application, before any other hook.

Reimplemented in Quasar::ImGuiLayer.

◆ OnDetach()

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

Called once when the layer is removed from the application, after every other hook.

Reimplemented in Quasar::ImGuiLayer.

◆ OnUpdate()

virtual void Quasar::Layer::OnUpdate ( Timestep timestep)
inlinevirtual

Called once per frame to update the layer.

Parameters
timestepTime elapsed since the previous frame.

◆ OnEvent()

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

Called for each event received by the layer.

Mark the event as handled to stop it from reaching the layers below this one.

Reimplemented in Quasar::ImGuiLayer.


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