1 #ifndef UGDK_ACTION_3D_ELEMENT_H_
2 #define UGDK_ACTION_3D_ELEMENT_H_
7 #include <unordered_map>
26 class Element :
public std::enable_shared_from_this<Element> {
35 void AddComponent(
const std::shared_ptr<Component> &the_component);
44 Ogre::SceneNode&
node() {
return *node_; }
46 std::string
name()
const {
return name_; }
53 std::unordered_map<std::type_index, std::shared_ptr<Component>> components_;
54 Ogre::SceneNode *node_;
59 bool marked_for_removal_;
64 auto check = components_.find(
typeid(T));
65 if (check == components_.end()) {
68 return dynamic_cast<T*
>(check->second.get());
bool marked_for_removal() const
Definition: element.h:42
A 3D Element.
Definition: element.h:26
virtual void OnParentDestroyed()
Definition: element.h:50
std::string name() const
Definition: element.h:46
Definition: animation.h:11
T * component()
Definition: element.h:63
Scene3D & scene()
Definition: element.h:45
virtual void OnAttach()
Definition: element.h:49
void AddComponent(const std::shared_ptr< Component > &the_component)
Element(Scene3D &scene, const std::string &name="")
void AttachTo(Element &parent)
Element & operator=(const Element &)=delete
Ogre::SceneNode & node()
Definition: element.h:44
A 3D game scene, or screen.
Definition: scene3d.h:32