-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntity.h
42 lines (32 loc) · 1.05 KB
/
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
42
#pragma once
#include <SFML/Graphics.hpp>
class Entity {
public:
explicit Entity(const std::string& spriteFile);
Entity() = default;
virtual ~Entity() = default;
void move(float x, float y);
void move(const sf::Vector2f pos);
void setPosition(const sf::Vector2f pos);
void setPosition(const float x, const float y);
sf::Vector2f getPosition();
sf::Vector2f getLastPosition() const;
void setSprite(sf::Texture* texture, const sf::IntRect rect = sf::IntRect{0,0,32,32});
sf::Sprite& getSprite();
void setTextureRect(const sf::IntRect rect);
void setTexture(const std::string& file);
sf::Texture* getTexture();
sf::FloatRect getLocalBounds() const;
sf::FloatRect getGlobalBounds() const;
void setColor(const sf::Color color);
void setScale(const float x, const float y);
sf::Vector2f getScale();
virtual void processInput();
virtual void update(const float dt);
virtual void draw(sf::RenderTarget* target);
protected:
sf::Texture texture;
sf::Sprite sprite;
sf::IntRect rect;
sf::Vector2f lastPos;
};