Hymn to Beauty
C++ 3D Engine
World Class Reference

The game world containing all entities. More...

#include <World.hpp>

Public Member Functions

 World ()
 Create a new world. More...
 
 ~World ()
 Destructor. More...
 
EntityCreateEntity (const std::string &name="")
 Create a new entity in the world. More...
 
const std::vector< Entity * > & GetEntities () const
 Get all the entities in the world. More...
 
void CreateRoot ()
 Create root entity. More...
 
EntityGetRoot () const
 Get the root entity. More...
 
void RegisterUpdate (Entity *entity)
 Register an entity to receive update events. More...
 
const std::vector< Entity * > & GetUpdateEntities () const
 Get all entities that are registered to receive update events. More...
 
void Clear ()
 Clear the world of all entities. More...
 
void ClearKilled ()
 Removes all killed entities and components in the world. More...
 
void Save (const std::string &filename) const
 Save the world to file. More...
 
Json::Value GetSaveJson () const
 Get a json file representing the root. More...
 
void Load (const std::string &filename)
 Load the world from file. More...
 
void Load (Json::Value &node)
 Load the world from a json. More...
 

Friends

class Entity
 

Detailed Description

The game world containing all entities.

Constructor & Destructor Documentation

◆ World()

World::World ( )

Create a new world.

◆ ~World()

World::~World ( )

Destructor.

Member Function Documentation

◆ Clear()

void World::Clear ( )

Clear the world of all entities.

◆ ClearKilled()

void World::ClearKilled ( )

Removes all killed entities and components in the world.

◆ CreateEntity()

Entity * World::CreateEntity ( const std::string &  name = "")

Create a new entity in the world.

Parameters
nameName of the entity to create.
Returns
The new entity.

◆ CreateRoot()

void World::CreateRoot ( )

Create root entity.

◆ GetEntities()

const std::vector< Entity * > & World::GetEntities ( ) const

Get all the entities in the world.

Returns
The entities in the world.

◆ GetRoot()

Entity * World::GetRoot ( ) const

Get the root entity.

Returns
The root entity.

◆ GetSaveJson()

Json::Value World::GetSaveJson ( ) const

Get a json file representing the root.

Returns
The json file representing the root.

◆ GetUpdateEntities()

const std::vector< Entity * > & World::GetUpdateEntities ( ) const

Get all entities that are registered to receive update events.

Returns
A list of all entities registered to receive update events.

◆ Load() [1/2]

void World::Load ( const std::string &  filename)

Load the world from file.

Parameters
filenameThe name of the file.

◆ Load() [2/2]

void World::Load ( Json::Value &  node)

Load the world from a json.

Parameters
nodeThe json containing a scene to load.

◆ RegisterUpdate()

void World::RegisterUpdate ( Entity entity)

Register an entity to receive update events.

Parameters
entityEntity to register.

◆ Save()

void World::Save ( const std::string &  filename) const

Save the world to file.

Parameters
filenameThe name of the file.

Friends And Related Function Documentation

◆ Entity

friend class Entity
friend

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