galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Scene.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_SCENE_SCENE_HPP_
9#define GALAXY_SCENE_SCENE_HPP_
10
11#include <entt/signal/dispatcher.hpp>
12#include <nlohmann/json_fwd.hpp>
13#include <SDL3/SDL_events.h>
14
18
19namespace galaxy
20{
27 class Scene : public State, public Serializable
28 {
29 public:
35 Scene(const std::string& name) noexcept;
36
40 virtual ~Scene() noexcept;
41
45 void on_push() override;
46
50 void on_pop() override;
51
57 virtual void on_event(SDL_Event& event);
58
64 virtual void update(EntityManager& em);
65
69 virtual void render();
70
76 [[nodiscard]]
77 SystemManager& sys_man() noexcept;
78
84 [[nodiscard]]
85 nlohmann::json serialize() override;
86
92 void deserialize(const nlohmann::json& json) override;
93
94 private:
98 Scene() = delete;
99
103 Scene(const Scene&) = delete;
104
108 Scene& operator=(const Scene&) = delete;
109
110 private:
115
119 entt::dispatcher m_dispatcher;
120 };
121} // namespace galaxy
122
123/*
127void update_ui();
128
132 void only_update_rendering();
133
141[[nodiscard]]
142bool load_world(const std::string& file);
143
147graphics::Camera m_camera;
148
149
153b2World m_b2world;
154
158map::World m_world;
159
163int m_velocity_iterations;
164
168int m_position_iterations;
169
173 std::size_t m_rendersystem_index;
174*/
175
176#endif
Class for making creating and managing entities easier.
void on_push() override
When scene is pushed to the stack.
Definition Scene.cpp:47
nlohmann::json serialize() override
Serializes object.
Definition Scene.cpp:288
Scene(const Scene &)=delete
Copy constructor.
Scene & operator=(const Scene &)=delete
Copy assignment operator.
virtual void update(EntityManager &em)
Process events and updates.
Definition Scene.cpp:248
void deserialize(const nlohmann::json &json) override
Deserializes from object.
Definition Scene.cpp:341
void on_pop() override
When scene is popped from the stack.
Definition Scene.cpp:51
virtual void on_event(SDL_Event &event)
Handle an event for a scene.
Definition Scene.cpp:59
entt::dispatcher m_dispatcher
Scene event handler.
Definition Scene.hpp:119
SystemManager m_sysman
Systems only used by this scene.
Definition Scene.hpp:114
Scene(const std::string &name) noexcept
Name constructor.
Definition Scene.cpp:27
virtual void render()
Render scene.
Definition Scene.cpp:260
SystemManager & sys_man() noexcept
Get system manager.
Definition Scene.cpp:395
Scene()=delete
Constructor.
Serializable() noexcept=default
Constructor.
const std::string & name() const noexcept
Get state name.
Definition State.cpp:17
State(State &&)=default
Move constructor.
Manages the systems assigned to it.
Tag.cpp galaxy.
Definition Tag.cpp:13