-
Notifications
You must be signed in to change notification settings - Fork 0
/
Entity.h
41 lines (31 loc) · 978 Bytes
/
Entity.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef ENTITY_H
#define ENTITY_H
#include "ILevelObject.h"
#include "ICollidable.h"
class Entity : public ILevelObject, public ICollidable
{
protected:
sf::Sprite sprite;
sf::Color color;
public:
Entity(sf::Color c = sf::Color(127, 127, 127)) : sprite(), color(c) {}
const sf::Vector2f& getPosition() const override {
return sprite.getPosition();
}
void setPosition(const sf::Vector2f& pos) override {
sprite.setPosition(pos);
}
sf::FloatRect getCollisionBox() const override {
return sprite.getGlobalBounds();
}
const sf::Color& getColor() const override {
return color;
}
void update(Level& level, sf::Time delta) override {
//Do nothing
};
void draw(sf::RenderTarget& target, sf::RenderStates states) const override {
target.draw(sprite);
};
};
#endif // ENTITY_H