PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
Layer.hpp
1#pragma once
2
3#include "PixelBullet/Scene/Scene.hpp"
4#include "PixelBullet/Time/Duration.hpp"
5
6#include <memory>
7#include <string>
8
9namespace PixelBullet
10{
11 class Event;
12
13 class Layer
14 {
15 public:
16 explicit Layer(const std::string& name = "Layer");
17 virtual ~Layer() = default;
18
19 virtual void OnAttach()
20 {
21 }
22 virtual void OnDetach()
23 {
24 }
25 virtual void OnUpdate(Duration ts)
26 {
27 }
28 virtual void OnImGuiRender()
29 {
30 }
31 virtual void OnEvent(Event& event)
32 {
33 }
34
35 virtual Scene* GetScene()
36 {
37 return m_Scene.get();
38 }
39 virtual const Scene* GetScene() const
40 {
41 return m_Scene.get();
42 }
43
44 const std::string& GetName() const
45 {
46 return m_DebugName;
47 }
48
49 protected:
50 std::string m_DebugName;
51 std::unique_ptr<Scene> m_Scene = nullptr;
52 };
53} // namespace PixelBullet
A lightweight duration class that holds a time span in seconds.
Definition Duration.hpp:9
Definition Event.hpp:65
Definition Layer.hpp:14
Definition Scene.hpp:18