Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
component_manager.h
Go to the documentation of this file.
1 #ifndef COMPONENT_MANAGER_H
2 #define COMPONENT_MANAGER_H
3 #include <map>
4 #include <memory>
5 #include <map>
6 #include "component.h"
7 #include "graphics/camera.h"
8 
9 //= SCRIPTABLE
10 
15  private:
16  std::multimap<unsigned long long, std::shared_ptr<Component>> components;
17  std::weak_ptr<Graphics::Camera> camera;
18  public:
19  //= BEGIN SCRIPTABLE
20 
26  void addComponent(std::shared_ptr<Component> component);
32  void addComponents(std::vector<std::shared_ptr<Component>> components);
38  void addComponents(std::list<std::shared_ptr<Component>> components);
44  void removeComponent(std::shared_ptr<Component> component);
50  void removeComponents(std::vector<std::shared_ptr<Component>> components);
56  unsigned int count() const noexcept;
57  //= END SCRIPTABLE
58 
64  void addComponent(std::shared_ptr<Graphics::Camera> component);
68  void onStart();
74  void onUpdate(const float delta);
78  void destroy();
79 
80 };
81 #endif
Class for component manager.
Definition: component_manager.h:14
void addComponents(std::vector< std::shared_ptr< Component >> components)
Adds components.
Definition: component_manager.cpp:19
unsigned int count() const noexcept
Gets the number of components.
Definition: component_manager.cpp:45
void onStart()
Calls onStart on each component.
Definition: component_manager.cpp:49
void destroy()
Calls onDestroy on each component.
Definition: component_manager.cpp:69
void removeComponents(std::vector< std::shared_ptr< Component >> components)
Removes components.
Definition: component_manager.cpp:40
void removeComponent(std::shared_ptr< Component > component)
Removes a component.
Definition: component_manager.cpp:31
void onUpdate(const float delta)
Calls onUpdate on each component, once per frame.
Definition: component_manager.cpp:57
void addComponent(std::shared_ptr< Component > component)
Adds a component.
Definition: component_manager.cpp:10