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
galaxy::scene::Scene Class Referencefinal

Represents a scene in a game. Like the menu, game, etc. More...

#include <Scene.hpp>

+ Inheritance diagram for galaxy::scene::Scene:
+ Collaboration diagram for galaxy::scene::Scene:

Public Member Functions

 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 &registry)
 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 Member Functions inherited from galaxy::fs::Serializable
virtual ~Serializable ()
 Destructor.
 
virtual Serializableoperator= (Serializable &&)=default
 Move assignment operator.
 
virtual Serializableoperator= (const Serializable &)=default
 Copy assignment operator.
 

Private Member Functions

 Scene ()=delete
 Constructor.
 

Private Attributes

std::string m_name
 Scene name for debug purposes.
 
meta::SystemStack m_systems
 List of systems to run.
 

Additional Inherited Members

- Protected Member Functions inherited from galaxy::fs::Serializable
 Serializable ()
 Constructor.
 

Detailed Description

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.

Definition at line 28 of file Scene.hpp.

Constructor & Destructor Documentation

◆ Scene() [1/2]

galaxy::scene::Scene::Scene ( const std::string & name)

Name constructor.

Parameters
nameName of the scene for debug / editor purposes.

Definition at line 18 of file Scene.cpp.

◆ ~Scene()

galaxy::scene::Scene::~Scene ( )
virtual

Destructor.

Definition at line 35 of file Scene.cpp.

◆ Scene() [2/2]

galaxy::scene::Scene::Scene ( )
privatedelete

Constructor.

Member Function Documentation

◆ add_system()

void galaxy::scene::Scene::add_system ( const std::string & system)

Add a system to operate on entities in this scene.

Scene is called in order of adding. So i.e. if you add anim then render, systems are called in that order.

Parameters
systemName of system to add to this scene.

Definition at line 40 of file Scene.cpp.

+ Here is the caller graph for this function:

◆ load()

void galaxy::scene::Scene::load ( )

When scene is loaded and made active.

Definition at line 46 of file Scene.cpp.

+ Here is the caller graph for this function:

◆ unload()

void galaxy::scene::Scene::unload ( )

When scene is deactivated / unloaded.

Definition at line 50 of file Scene.cpp.

+ Here is the caller graph for this function:

◆ update()

void galaxy::scene::Scene::update ( core::Registry & registry)

Process events and updates.

Parameters
registryRegistry to process.

Definition at line 55 of file Scene.cpp.

+ Here is the caller graph for this function:

◆ render()

void galaxy::scene::Scene::render ( )

Update ui.

Render scene.

Definition at line 78 of file Scene.cpp.

+ Here is the caller graph for this function:

◆ name()

const std::string & galaxy::scene::Scene::name ( ) const
nodiscardnoexcept

Get scene name.

Definition at line 103 of file Scene.cpp.

+ Here is the caller graph for this function:

◆ serialize()

nlohmann::json galaxy::scene::Scene::serialize ( )
nodiscardoverridevirtual

Serializes object.

Returns
JSON object containing data to write out.

Implements galaxy::fs::Serializable.

Definition at line 119 of file Scene.cpp.

◆ deserialize()

void galaxy::scene::Scene::deserialize ( const nlohmann::json & json)
overridevirtual

Deserializes from object.

Parameters
jsonJson object to retrieve data from.

Implements galaxy::fs::Serializable.

Definition at line 151 of file Scene.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_name

std::string galaxy::scene::Scene::m_name
private

Scene name for debug purposes.

Definition at line 110 of file Scene.hpp.

◆ m_systems

meta::SystemStack galaxy::scene::Scene::m_systems
private

List of systems to run.

Definition at line 115 of file Scene.hpp.


The documentation for this class was generated from the following files: