CmComponent.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmGameObject.h"
  4. namespace CamelotFramework
  5. {
  6. class CM_EXPORT Component : public GameObject
  7. {
  8. public:
  9. /**
  10. * @brief Returns the SceneObject this Component is assigned to.
  11. */
  12. HSceneObject sceneObject() const { return mParent; }
  13. /**
  14. * @brief Same as sceneObject(), just a shorter name.
  15. */
  16. HSceneObject SO() const { return sceneObject(); }
  17. /**
  18. * @brief Called once per frame on all components.
  19. */
  20. virtual void update() = 0;
  21. protected:
  22. friend class SceneObject;
  23. Component(const HSceneObject& parent);
  24. virtual ~Component();
  25. HSceneObject mParent;
  26. /************************************************************************/
  27. /* RTTI */
  28. /************************************************************************/
  29. public:
  30. friend class ComponentRTTI;
  31. static RTTITypeBase* getRTTIStatic();
  32. virtual RTTITypeBase* getRTTI() const;
  33. protected:
  34. Component() {} // Serialization only
  35. };
  36. }