R-TYPE
Sprite.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2022
3 ** r-type
4 ** File description:
5 ** Sprite
6 */
7 
8 #ifndef _Sprite
9 #define _Sprite
10 
11 #include "IComp.hpp"
12 #include "SFML/Graphics.hpp"
13 
14 namespace ECS {
15 
16 class Sprite : public IComp {
17 public:
18  explicit Sprite(const sf::Texture& texture, sf::Vector2f scale, sf::IntRect intRect = sf::IntRect(0, 0, 0, 0), sf::Vector2f pos = sf::Vector2f(0, 0)) noexcept;
19  explicit Sprite(const sf::Texture& texture, int scaleX, int scaleY, sf::IntRect intRect, sf::Vector2f pos) noexcept;
20  explicit Sprite(const sf::Texture& texture, int scaleX, int scaleY, int left, int top, int width, int height, sf::Vector2f pos) noexcept;
21  Sprite(const Sprite& sprite) noexcept;
22  explicit Sprite(Sprite&&) noexcept = delete;
23  ~Sprite() noexcept override = default;
24 
25  void setSprite(sf::Sprite* sprite) noexcept;
26  void setTexture(const sf::Texture& texture) noexcept;
27  [[nodiscard]] sf::Sprite* getSprite() const noexcept;
28  [[nodiscard]] const sf::Texture* getTexture() const noexcept;
29 
30  void setIntRect(sf::IntRect rect) noexcept;
31  void setIntRect(int left, int top, int width, int height) noexcept;
32  [[nodiscard]] sf::IntRect getIntRect() const noexcept;
33 
34  void setScale(int x, int y) noexcept;
35  void setScale(sf::Vector2f scale) noexcept;
36  [[nodiscard]] sf::Vector2f getScale() const noexcept;
37 
38  void setPosition(int x, int y) noexcept;
39  void setPosition(sf::Vector2f pos) noexcept;
40  [[nodiscard]] sf::Vector2f getPosition() const noexcept;
41 
42  Sprite& operator=(const Sprite&) const noexcept = delete;
43  Sprite& operator=(Sprite&&) const noexcept = delete;
44 
45 private:
46  sf::Vector2f _scale;
47  sf::IntRect _intRect;
48  sf::Vector2f _pos;
49  sf::Sprite* _sprite;
50 };
51 
52 };
53 
54 #endif
Definition: IComp.hpp:7
Definition: Sprite.hpp:16
Sprite(Sprite &&) noexcept=delete
sf::Vector2f getScale() const noexcept
Definition: Sprite.cpp:207
const sf::Texture * getTexture() const noexcept
Definition: Sprite.cpp:138
void setIntRect(sf::IntRect rect) noexcept
Definition: Sprite.cpp:145
void setTexture(const sf::Texture &texture) noexcept
Definition: Sprite.cpp:121
sf::Sprite * getSprite() const noexcept
Definition: Sprite.cpp:131
sf::IntRect getIntRect() const noexcept
Definition: Sprite.cpp:176
sf::Vector2f getPosition() const noexcept
Definition: Sprite.cpp:238
void setPosition(int x, int y) noexcept
Definition: Sprite.cpp:215
void setSprite(sf::Sprite *sprite) noexcept
Definition: Sprite.cpp:111
void setScale(int x, int y) noexcept
Definition: Sprite.cpp:184
Sprite(const sf::Texture &texture, sf::Vector2f scale, sf::IntRect intRect=sf::IntRect(0, 0, 0, 0), sf::Vector2f pos=sf::Vector2f(0, 0)) noexcept
Definition: Sprite.cpp:22
Definition: ComponentManager.hpp:14