CmComponent.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmGameObjectREAL.h"
  4. namespace CamelotEngine
  5. {
  6. class CM_EXPORT Component : public GameObjectREAL
  7. {
  8. public:
  9. /**
  10. * @brief Returns the GameObject this Component is assigned to.
  11. */
  12. HGameObject gameObject() const { return mParent; }
  13. /**
  14. * @brief Same as gameObject(), just a shorter name.
  15. */
  16. HGameObject GO() const { return gameObject(); }
  17. /**
  18. * @brief Called once per frame on all components.
  19. */
  20. virtual void update() = 0;
  21. virtual ~Component();
  22. protected:
  23. friend class GameObject;
  24. Component(const HGameObject& parent);
  25. HGameObject 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. }