Class World
Defined in File World.hpp
Inheritance Relationships
Base Type
public Cacao::Resource(Class Resource)
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 MakeToplevel(ActorRef actor)
Make an Actor a toplevel (no parent, at root of world tree)
- Parameters:
actor – The actor to make toplevel
- Throws:
BadValueException – If the actor does not belong to this world
-
std::vector<ActorRef> GetToplevelActors() const
Get a list of actors that are toplevel (have no parent)
-
ActorRef CreateActor(const std::string &name, ActorRef parent = {})
Create a new Actor in the world.
- Parameters:
name – The name for this new actor
parent – The parent for this new actor (leave as a null ref to make toplevel)
- Throws:
NonexistentValueException – If the ref references a nonexistent actor or is out-of-date
-
template<typename P>
inline std::vector<ActorRef> FindActors(P predicate) const Find an Actor according to some arbitrary condition.
- Parameters:
predicate – The predicate to check each actor against
- Returns:
An optional that contains the actor if it was found
-
inline glm::vec3 GetSkyboxRotationEuler() const
Get the rotation of the skybox as Euler angles in degrees.
- Returns:
The rotation as Euler angles
-
inline void SetSkyboxRotation(glm::quat rot)
Set the rotation of the skybox.
- Parameters:
rot – The new rotation
Public Members
-
std::shared_ptr<Cubemap> skyboxTex
Cube texture to use as the skybox.
Public Static Functions
-
static std::shared_ptr<World> Create(bool useOrthographicCamera, const std::string &addr)
Create a new blank world.
- Parameters:
useOrthographicCamera – Whether to use an orthographic camera (true) or perspective camera (false)
addr – The resource address to associate with the world
- Throws:
BadValueException – If the address is malformed
-
void MakeToplevel(ActorRef actor)