-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sprite.hpp
37 lines (28 loc) · 833 Bytes
/
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
//
// Created by borysiak on 02.11.2019.
//
#ifndef BGUI_SPRITE_HPP
#define BGUI_SPRITE_HPP
#include <SFML/Graphics/Vertex.hpp>
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/VertexBuffer.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include "Resource/Resource.hpp"
#include "Resource/TextureData.hpp"
class Sprite :public sf::Drawable
{
public:
Sprite();
Sprite & operator = (const Sprite & sprite);
void setTextureData(TextureData & resource);
void createVertices(const sf::Vector2f & _size);
void updateVertices(const sf::Vector2f & _size);
protected:
void draw(sf::RenderTarget& target, sf::RenderStates states) const final ;
private:
std::array<sf::Vertex,22> vertices;
sf::VertexBuffer buffer;
TextureData texture;
sf::Vector2f size;
};
#endif //BGUI_SPRITE_HPP