SimpleEngine/include/simpleengine/component.h

34 lines
820 B
C
Raw Permalink Normal View History

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