NasNas
An intuitive and beginner friendly 2D game framework for C++
VertexArray.hpp
1 
5 #pragma once
6 
7 #include <SFML/Graphics/RenderTarget.hpp>
8 #include <SFML/Graphics/Texture.hpp>
9 #include <SFML/Graphics/VertexArray.hpp>
10 
11 namespace ns {
12  class VertexArray : public sf::VertexArray {
13  public:
14  void setTexture(const sf::Texture& texture) {
15  m_texture = &texture;
16  }
17  auto getPosition() const -> sf::Vector2f;
18 
19  private:
20  void draw(sf::RenderTarget &target, sf::RenderStates states) const override;
21 
22  const sf::Texture* m_texture = nullptr;
23  };
24 }