Class World

Inheritance Relationships

Base Type

Class Documentation

class World : public Cacao::Resource

A collection of entities and a camera comprising an area of gameplay.

Warning

If there are still outstanding references to contained Actors when the destructor is called, it may not be able to prevent memory leaks and the Actor will probably be in a broken state.

Public Functions

void ReparentToRoot(ActorHandle actor)

Set an actor’s parent to the root actor (adding it to the world if it wasn’t already)

Parameters:

actor – The actor to reparent

std::vector<ActorHandle> GetRootChildren() const

Get all entities that are direct children of the root actor.

template<typename P>
inline std::optional<ActorHandle> FindActor(P predicate) const

Find an Actor by some arbitrary condition.

Parameters:

predicate – The predicate to check each actor against

Returns:

An optional that contains the actor if it was found

~World()

Public Members

std::shared_ptr<Camera> cam

World camera that will be used to render everything else.

std::shared_ptr<Cubemap> skyboxTex

Cube texture to use as the skybox.

Public Static Functions

static inline std::shared_ptr<World> Create(libcacaoformats::World &&world, const std::string &addr)

Create a new world from data.

Parameters:
  • world – The libcacaoformats representation of the world

  • addr – The resource address identifier to associate with the world

static inline std::shared_ptr<World> Create(const std::string &addr)

Create a new blank world.

Parameters:

addr – The resource address identifier to associate with the world