2
0

Component.h 784 B

123456789101112131415161718192021222324252627
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #pragma once
  9. class Component
  10. {
  11. public:
  12. // Constructor
  13. // (the lower the update order, the earlier the component updates)
  14. Component(class Actor* owner, int updateOrder = 100);
  15. // Destructor
  16. virtual ~Component();
  17. // Update this component by delta time
  18. virtual void Update(float deltaTime);
  19. int GetUpdateOrder() const { return mUpdateOrder; }
  20. protected:
  21. // Owning actor
  22. class Actor* mOwner;
  23. // Update order of component
  24. int mUpdateOrder;
  25. };