// ---------------------------------------------------------------- // From Game Programming in C++ by Sanjay Madhav // Copyright (C) 2017 Sanjay Madhav. All rights reserved. // // Released under the BSD License // See LICENSE in root directory for full details. // ---------------------------------------------------------------- #pragma once #include class Component { public: // Constructor // (the lower the update order, the earlier the component updates) Component(class Actor* owner, int updateOrder = 100); // Destructor virtual ~Component(); // Update this component by delta time virtual void Update(float deltaTime); // Process input for this component virtual void ProcessInput(const uint8_t* keyState) {} // Called when world transform changes virtual void OnUpdateWorldTransform() { } class Actor* GetOwner() { return mOwner; } int GetUpdateOrder() const { return mUpdateOrder; } protected: // Owning actor class Actor* mOwner; // Update order of component int mUpdateOrder; };