36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <utils.hpp>
|
|
#include <string>
|
|
|
|
namespace Game::Object {
|
|
class Entity;
|
|
}
|
|
|
|
namespace Game::Object::Components {
|
|
class Component {
|
|
public:
|
|
Component() = default;
|
|
|
|
// Declare copy and move; in case components declare some other things, we want to make sure those are properly copied/moved as well, so we'll just define these as virtual and implement them in the .cpp file
|
|
Component(const Component&);
|
|
Component& operator=(const Component&);
|
|
Component(Component&&) noexcept;
|
|
Component& operator=(Component&&) noexcept;
|
|
|
|
virtual ~Component() = 0;
|
|
virtual void start(Object::Entity* thisEntity) = 0;
|
|
virtual void update(float deltaTime, Object::Entity* thisEntity) = 0;
|
|
|
|
// Getters and setters
|
|
void setName(const std::string& name);
|
|
std::string getName();
|
|
void setActive(bool active);
|
|
bool isActive();
|
|
|
|
protected:
|
|
// Uniqueness is NOT enforced; be careful when naming!
|
|
std::string mName;
|
|
bool mIsActive = true;
|
|
};
|
|
} |