![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Represents a scene in a game. Like the menu, game, etc. Does not share resources. More...
#include <Scene.hpp>
Public Member Functions | |
Scene (const std::string &name) | |
Name constructor. | |
virtual | ~Scene () |
Destructor. | |
virtual void | load () |
When scene is loaded and made active. | |
virtual void | unload () |
When scene is deactivated / unloaded. | |
virtual void | update () |
Process events and updates. | |
virtual void | render () |
Render scene. | |
bool | load_world (const std::string &file) |
Loads an LDTK world for this scene. | |
nlohmann::json | serialize () override |
Serializes object. | |
void | deserialize (const nlohmann::json &json) override |
Deserializes from object. | |
Scene (const std::string &name) | |
Name constructor. | |
virtual | ~Scene () |
Destructor. | |
void | add_system (const std::string &system) |
Add a system to operate on entities in this scene. | |
void | load () |
When scene is loaded and made active. | |
void | unload () |
When scene is deactivated / unloaded. | |
void | update (core::Registry ®istry) |
Process events and updates. | |
void | render () |
Update ui. | |
const std::string & | name () const noexcept |
Get scene name. | |
nlohmann::json | serialize () override |
Serializes object. | |
void | deserialize (const nlohmann::json &json) override |
Deserializes from object. | |
Public Attributes | |
std::string | m_name |
Scene name for debug purposes. | |
graphics::Camera | m_camera |
Camera. | |
entt::dispatcher | m_dispatcher |
Scene event handler. | |
core::Registry | m_registry |
Entity data. | |
b2World | m_b2world |
Box2D physics world. | |
map::World | m_world |
LDTK world. | |
int | m_velocity_iterations |
Box2D world velocity iterations. | |
int | m_position_iterations |
Box2d world position iterations. | |
Private Member Functions | |
Scene ()=delete | |
Constructor. | |
Scene ()=delete | |
Constructor. | |
Private Attributes | |
meta::SystemStack | m_systems |
List of systems to run. | |
Represents a scene in a game. Like the menu, game, etc. Does not share resources.
Represents a scene in a game. Like the menu, game, etc.
Scenes should be logically grouped -> i.e. a map, player data + ui, battle, menu, etc. Each scene is an independant collection of systems, but not entities.
galaxy::scene::Scene::Scene | ( | const std::string & | name | ) |
|
privatedelete |
Constructor.
galaxy::scene::Scene::Scene | ( | const std::string & | name | ) |
Name constructor.
name | Name of the scene for debug / editor purposes. |
|
virtual |
Destructor.
|
privatedelete |
Constructor.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
nodiscard |
|
nodiscardoverride |
|
override |
void galaxy::scene::Scene::add_system | ( | const std::string & | system | ) |
void galaxy::scene::Scene::load | ( | ) |
When scene is loaded and made active.
void galaxy::scene::Scene::unload | ( | ) |
When scene is deactivated / unloaded.
void galaxy::scene::Scene::update | ( | core::Registry & | registry | ) |
void galaxy::scene::Scene::render | ( | ) |
Update ui.
Render scene.
|
nodiscardnoexcept |
|
nodiscardoverride |
Serializes object.
|
override |
Deserializes from object.
json | Json object to retrieve data from. |
std::string galaxy::scene::Scene::m_name |
graphics::Camera galaxy::scene::Scene::m_camera |
entt::dispatcher galaxy::scene::Scene::m_dispatcher |
core::Registry galaxy::scene::Scene::m_registry |
b2World galaxy::scene::Scene::m_b2world |
map::World galaxy::scene::Scene::m_world |
int galaxy::scene::Scene::m_velocity_iterations |
int galaxy::scene::Scene::m_position_iterations |
|
private |