2020-07-03 18:31:17 +00:00
|
|
|
//
|
|
|
|
// Created by SeanOMik on 7/2/2020.
|
|
|
|
// Github: https://github.com/SeanOMik
|
|
|
|
// Email: seanomik@gmail.com
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef SIMPLEENGINE_COMPONENT_H
|
|
|
|
#define SIMPLEENGINE_COMPONENT_H
|
|
|
|
|
2021-03-12 23:18:23 +00:00
|
|
|
#include "destructable.h"
|
|
|
|
|
2020-07-03 18:31:17 +00:00
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
2020-07-03 20:26:44 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2020-07-03 18:31:17 +00:00
|
|
|
namespace simpleengine {
|
|
|
|
class Entity;
|
2021-03-12 23:18:23 +00:00
|
|
|
class Component : public simpleengine::Destructable {
|
2020-07-03 18:31:17 +00:00
|
|
|
public:
|
2021-03-12 23:18:23 +00:00
|
|
|
explicit Component(Entity& owning_entity) : owning_entity(owning_entity) {
|
2020-07-03 20:26:44 +00:00
|
|
|
|
2021-03-12 23:18:23 +00:00
|
|
|
}
|
|
|
|
virtual ~Component() = default;
|
2020-07-03 18:31:17 +00:00
|
|
|
|
|
|
|
virtual void Update(const float& delta_time) = 0;
|
2020-07-03 18:34:22 +00:00
|
|
|
virtual void Render(sf::RenderTarget* target) {}; // Most components won't need to be rendered.
|
2020-07-03 18:31:17 +00:00
|
|
|
protected:
|
2020-07-03 20:26:44 +00:00
|
|
|
Entity& owning_entity;
|
|
|
|
bool destroying = false;
|
2020-07-03 18:31:17 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //SIMPLEENGINE_COMPONENT_H
|