SimpleEngine/include/simpleengine/events/entity_event.h

43 lines
1.1 KiB
C
Raw Normal View History

//
// Created by SeanOMik on 7/3/2020.
// Github: https://github.com/SeanOMik
// Email: seanomik@gmail.com
//
#ifndef SIMPLEENGINE_ENTITY_EVENT_H
#define SIMPLEENGINE_ENTITY_EVENT_H
#include "../event.h"
#include "../entity.h"
namespace simpleengine {
class EntityEvent : public Event {
public:
2020-07-03 20:26:44 +00:00
explicit EntityEvent(sf::RenderWindow* window, std::unique_ptr<Entity> entity) : simpleengine::Event(window), entity(std::move(entity)) {
}
void CheckForQuit() override {
/*if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) {
quit = true;
}*/
}
void Update(const float& delta_time) override {
entity->Update(delta_time);
2020-07-03 20:26:44 +00:00
if (entity->IsGettingDestroyed()) {
entity->DestroyLater();
}
}
void Render(sf::RenderTarget* target) override {
entity->Render(target);
}
private:
2020-07-03 20:26:44 +00:00
std::unique_ptr<Entity> entity;
};
}
#endif //SIMPLEENGINE_ENTITY_EVENT_H