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
17
18namespace galaxy
19{
26 class Scene : public State
27 {
28 public:
34 Scene(const std::string& name) noexcept;
35
39 virtual ~Scene() noexcept;
40
44 void on_push() override;
45
49 void on_pop() override;
50
56 virtual void on_event(SDL_Event& event);
57
63 virtual void update(EntityManager& em);
64
68 virtual void render();
69
75 [[nodiscard]]
76 nlohmann::json serialize();
77
83 void deserialize(const nlohmann::json& json);
84
90 [[nodiscard]]
91 SystemManager& sys_man() noexcept;
92
93 private:
97 Scene() = delete;
98
102 Scene(const Scene&) = delete;
103
107 Scene& operator=(const Scene&) = delete;
108
109 private:
114
118 entt::dispatcher m_dispatcher;
119 };
120} // namespace galaxy
121
122/*
126void update_ui();
127
131 void only_update_rendering();
132
140[[nodiscard]]
141bool load_world(const std::string& file);
147[[nodiscard]]
148nlohmann::json serialize() override;
149
155void deserialize(const nlohmann::json& json) override;
159graphics::Camera m_camera;
160
161
165b2World m_b2world;
166
170map::World m_world;
171
175int m_velocity_iterations;
176
180int m_position_iterations;
181
185 std::size_t m_rendersystem_index;
186*/
187
188#endif
Class for making creating and managing entities easier.
Represents a scene in a game.
Definition Scene.hpp:27
void on_push() override
When scene is pushed to the stack.
Definition Scene.cpp:47
Scene(const Scene &)=delete
Copy constructor.
virtual ~Scene() noexcept
Destructor.
Definition Scene.cpp:43
void deserialize(const nlohmann::json &json)
Deserializes from object.
Definition Scene.cpp:351
Scene & operator=(const Scene &)=delete
Copy assignment operator.
virtual void update(EntityManager &em)
Process events and updates.
Definition Scene.cpp:254
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:118
SystemManager m_sysman
Systems only used by this scene.
Definition Scene.hpp:113
nlohmann::json serialize()
Serializes object.
Definition Scene.cpp:294
virtual void render()
Render scene.
Definition Scene.cpp:266
SystemManager & sys_man() noexcept
Get system manager.
Definition Scene.cpp:412
Scene()=delete
Constructor.
A state to use in a finite state machine.
Definition State.hpp:19
const std::string & name() const noexcept
Get state name.
Definition State.cpp:17
Manages the systems assigned to it.
Application.hpp galaxy.