-
Notifications
You must be signed in to change notification settings - Fork 1
/
Sprite.hpp
47 lines (38 loc) · 1.07 KB
/
Sprite.hpp
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
43
44
45
46
47
#ifndef SPRITE_HPP
#define SPRITE_HPP
#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/Rect.hpp>
#include "SpriteBatch.hpp"
namespace swift
{
class Sprite
{
public:
Sprite(SpriteBatch& batch);
Sprite(SpriteBatch& batch, const sf::IntRect& texRect);
~Sprite();
void move(const sf::Vector2f& offset);
void rotate(float a);
void scale(const sf::Vector2f& factor);
sf::IntRect getTextureRect() const;
sf::Color getColor() const;
sf::Vector2f getPosition() const;
float getRotation() const;
sf::Vector2f getScale() const;
sf::Vector2f getOrigin() const;
sf::FloatRect getLocalBounds() const;
sf::FloatRect getGlobalBounds() const;
void setTextureRect(const sf::IntRect& texRect);
void setColor(const sf::Color& color);
void setPosition(const sf::Vector2f& pos);
void setRotation(float a);
void setScale(const sf::Vector2f& scale);
void setOrigin(const sf::Vector2f& o);
private:
std::array<sf::Vertex*, 6> vertices;
sf::Vector2f origin;
sf::Vector2f scaleFactor;
float angle;
};
}
#endif // SPRITE_HPP