CoriEngine
Loading...
Searching...
No Matches
Cori::Core::Layer Class Reference

An abstract class that is ment to be used as a template for defining layers. More...

#include <Layer.hpp>

Inheritance diagram for Cori::Core::Layer:
Collaboration diagram for Cori::Core::Layer:

Public Member Functions

 Layer (std::string name)
virtual ~Layer ()
virtual void OnAttach ()
 Method that runs when the layer gets attached to the LayerStack.
virtual void OnDetach ()
 Method that runs when the layer gets detached to the LayerStack.
virtual void OnUpdate (GameTimer &gameTimer)
 Run every frame.
virtual void OnTickUpdate (GameTimer &gameTimer)
 Run every tick.
virtual void OnImGuiRender (GameTimer &gameTimer)
 Run every frame, this is the method where you do all the ImGui stuff.
virtual void OnEvent (Event &event)
 This is the method to handle all the event at.
void SetModal (const bool state)
 Change the Layer modal state.
bool IsModal () const
 Checks if the Layer is modal.
std::string_view GetName () const
 Returns the name of the Layer.
std::expected< void, CoriError<> > BindScene (const std::string &name)
 Binds the Scene to the Layer.
std::expected< void, CoriError<> > UnbindScene ()
 Unbinds the Scene from the Layer.

Public Attributes

World::SceneHandle ActiveScene { nullptr }
 A SceneHandle to the Scene that is currently bound.

Static Public Attributes

static Physics::DebugImguiRenderer m_DebugImGuiRenderer

Friends

class Application

Detailed Description

An abstract class that is ment to be used as a template for defining layers.

Definition at line 13 of file Layer.hpp.

Constructor & Destructor Documentation

◆ Layer()

Cori::Core::Layer::Layer ( std::string name)
explicit

Definition at line 7 of file Layer.cpp.

◆ ~Layer()

Cori::Core::Layer::~Layer ( )
virtual

Definition at line 14 of file Layer.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ BindScene()

std::expected< void, CoriError<> > Cori::Core::Layer::BindScene ( const std::string & name)

Binds the Scene to the Layer.

Parameters
nameName of the Scene to bind.
Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 26 of file Layer.cpp.

Here is the call graph for this function:

◆ GetName()

std::string_view Cori::Core::Layer::GetName ( ) const
inlinenodiscard

Returns the name of the Layer.

Returns
String view, so read only.

Definition at line 72 of file Layer.hpp.

◆ IsModal()

bool Cori::Core::Layer::IsModal ( ) const
inlinenodiscard

Checks if the Layer is modal.

Definition at line 66 of file Layer.hpp.

◆ OnAttach()

void Cori::Core::Layer::OnAttach ( )
virtual

Method that runs when the layer gets attached to the LayerStack.

Reimplemented in Cori::Core::Internal::ImGuiLayer.

Definition at line 18 of file Layer.cpp.

Here is the call graph for this function:

◆ OnDetach()

void Cori::Core::Layer::OnDetach ( )
virtual

Method that runs when the layer gets detached to the LayerStack.

Reimplemented in Cori::Core::Internal::ImGuiLayer.

Definition at line 22 of file Layer.cpp.

Here is the call graph for this function:

◆ OnEvent()

virtual void Cori::Core::Layer::OnEvent ( Event & event)
inlinevirtual

This is the method to handle all the event at.

Parameters
eventEvent to handle or skip.

Reimplemented in Cori::Core::Internal::ImGuiLayer.

Definition at line 52 of file Layer.hpp.

◆ OnImGuiRender()

virtual void Cori::Core::Layer::OnImGuiRender ( GameTimer & gameTimer)
inlinevirtual

Run every frame, this is the method where you do all the ImGui stuff.

Parameters
gameTimerGlobal timer.

Definition at line 46 of file Layer.hpp.

◆ OnTickUpdate()

virtual void Cori::Core::Layer::OnTickUpdate ( GameTimer & gameTimer)
inlinevirtual

Run every tick.

Parameters
gameTimerGlobal timer.

Definition at line 39 of file Layer.hpp.

◆ OnUpdate()

virtual void Cori::Core::Layer::OnUpdate ( GameTimer & gameTimer)
inlinevirtual

Run every frame.

Parameters
gameTimerGlobal timer.

Definition at line 33 of file Layer.hpp.

◆ SetModal()

void Cori::Core::Layer::SetModal ( const bool state)
inline

Change the Layer modal state.

Parameters
stateDesired state. @detail When Layer is in a modal state all events that are passed to it will be considered handled and will not be passed further down the LayerStack.
Also when a layer is modal any layer below it will not be updated, both tick update and frame update, it effectively stops any logic execution in the layers below it.

Definition at line 61 of file Layer.hpp.

◆ UnbindScene()

std::expected< void, CoriError<> > Cori::Core::Layer::UnbindScene ( )

Unbinds the Scene from the Layer.

Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 47 of file Layer.cpp.

Here is the call graph for this function:

◆ Application

friend class Application
friend

Definition at line 95 of file Layer.hpp.

Member Data Documentation

◆ ActiveScene

World::SceneHandle Cori::Core::Layer::ActiveScene { nullptr }

A SceneHandle to the Scene that is currently bound.

Definition at line 90 of file Layer.hpp.

◆ m_DebugImGuiRenderer

Physics::DebugImguiRenderer Cori::Core::Layer::m_DebugImGuiRenderer
inlinestatic

Definition at line 92 of file Layer.hpp.


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