Enigma 3.2.2
A Simple, Reliable and Efficient Encryption Tool
Loading...
Searching...
No Matches
Scene.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef ENIGMA_SCENE_H
3#define ENIGMA_SCENE_H
4
5#include <Core/Core.hpp>
6#include <Logger/Logger.hpp>
7
9#include <Events/Event.hpp>
11#include <Events/KeyEvent.hpp>
12#include <Events/MouseEvent.hpp>
13
14#include <mutex>
15
17/*
18* Scene Abstract class
19*/
20class Scene {
21 public:
22 friend class Application;
23
26
27 public:
28 Scene() noexcept;
29 virtual ~Scene() noexcept = default;
30
31 /* Scene Life Cycle */
32 virtual void OnCreate() = 0;
33 virtual void OnEvent(Event& event) = 0;
34 virtual void OnUpdate(const float& dt) = 0;
35 virtual void OnDraw() = 0;
36 virtual void OnImGuiDraw() = 0;
37 virtual void OnDestroy() = 0;
38
39 public: /*Accessors*/
40 const bool WantsToQuit() const noexcept { return m_quit; }
41 const bool IsLoading() const noexcept { return m_isLoading; }
42 std::mutex& GetMutex() noexcept { return m_mutex; }
43
44 public: /*Modifiers*/
45 void EndScene() noexcept { m_quit = true; }
46 void SetLoading(const bool loading) noexcept { m_isLoading = loading; }
47
48 protected:
49 std::mutex m_mutex{}; // each scene has a mutex, which will guard code running by worker thread separated from UI main thread. | used by std::scoped_lock
50 bool m_quit{};
52};
53
55
56#endif // !ENIGMA_SCENE_H
#define NS_ENIGMA_BEGIN
Enable/Disable Assertions.
Definition Macros.hpp:13
#define NS_ENIGMA_END
Definition Macros.hpp:14
const bool IsLoading() const noexcept
Definition Scene.hpp:41
virtual void OnDraw()=0
virtual void OnUpdate(const float &dt)=0
void EndScene() noexcept
Definition Scene.hpp:45
virtual void OnEvent(Event &event)=0
virtual void OnDestroy()=0
void SetLoading(const bool loading) noexcept
Definition Scene.hpp:46
std::mutex m_mutex
Definition Scene.hpp:49
bool m_quit
Definition Scene.hpp:50
ENIGMA_NON_MOVEABLE(Scene)
bool m_isLoading
Definition Scene.hpp:51
std::mutex & GetMutex() noexcept
Definition Scene.hpp:42
virtual void OnImGuiDraw()=0
Scene() noexcept
ENIGMA_NON_COPYABLE(Scene)
virtual void OnCreate()=0
const bool WantsToQuit() const noexcept
Definition Scene.hpp:40