Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scene.h
Go to the documentation of this file.
1 #ifndef SCENE_H
2 #define SCENE_H
3 #include <memory>
4 #include <vector>
6 #include "transform.h"
7 #include "component.h"
8 #include "entity.h"
9 
10 //= SCRIPTABLE
11 
12 namespace Game {
16  class Scene {
17  private:
18  std::shared_ptr<Transform> transform;
19  std::vector <std::shared_ptr<Component>> components;
20  std::vector<std::shared_ptr<Entity>> entities;
21  std::string name;
22  std::shared_ptr<Physics::CollisionData> collision_data;
23 
24  public:
25  Scene() = delete;
26  //= BEGIN SCRIPTABLE
32  Scene(const std::string scene_name);
38  void setTransform(std::shared_ptr<Transform> transform) noexcept;
44  std::shared_ptr<Transform> getTransform() const noexcept;
50  void addComponent(std::shared_ptr<Component> component);
56  void addComponent(std::shared_ptr<Physics::CollisionData> collision_data);
62  void addComponents(std::vector<std::shared_ptr<Component>> components);
68  std::vector<std::shared_ptr<Component>> getComponents() const noexcept;
69 
75  std::shared_ptr<Physics::CollisionData> getCollisionData() const noexcept;
81  void addEntity(std::shared_ptr<Entity> entity) noexcept;
87  void addEntities(std::vector<std::shared_ptr<Entity>> entities) noexcept;
93  std::vector<std::shared_ptr<Entity>> getEntities() const noexcept;
99  void setName(const std::string name) noexcept;
105  std::string getName() const noexcept;
106 
112  std::string to_string() const noexcept;
113  //= END SCRIPTABLE
114  };
115 }
116 #endif
std::string getName() const noexcept
Gets the name.
Definition: scene.cpp:65
std::vector< std::shared_ptr< Component > > getComponents() const noexcept
Gets all components.
Definition: scene.cpp:31
std::string to_string() const noexcept
Returns a string representation of the object, mostly for use in chaiscript.
Definition: scene.cpp:69
void addEntity(std::shared_ptr< Entity > entity) noexcept
Adds an entity.
Definition: scene.cpp:39
std::shared_ptr< Physics::CollisionData > getCollisionData() const noexcept
Gets the collision data.
Definition: scene.cpp:35
std::shared_ptr< Transform > getTransform() const noexcept
Gets the transform.
Definition: scene.cpp:14
A container holding a base transform, a vector of components, and a vector of entities.
Definition: scene.h:16
void addComponents(std::vector< std::shared_ptr< Component >> components)
Adds components.
Definition: scene.cpp:27
void setName(const std::string name) noexcept
Sets the name.
Definition: scene.cpp:61
Scene()=delete
std::vector< std::shared_ptr< Entity > > getEntities() const noexcept
Gets all entities.
Definition: scene.cpp:57
void addComponent(std::shared_ptr< Component > component)
Adds a component.
Definition: scene.cpp:18
void addEntities(std::vector< std::shared_ptr< Entity >> entities) noexcept
Adds entities.
Definition: scene.cpp:47
void setTransform(std::shared_ptr< Transform > transform) noexcept
Sets the transform.
Definition: scene.cpp:10