NasNas
An intuitive and beginner friendly 2D game framework for C++
ImageLayer.hpp
1 // Created by Modar Nasser on 06/09/2021.
2 
3 #pragma once
4 
5 #include <string>
6 
7 #include <SFML/Graphics/Texture.hpp>
8 #include <SFML/System/Vector2.hpp>
9 
10 #include <NasNas/tilemapping/Layer.hpp>
11 
12 namespace ns::tm {
13  class TiledMap;
14 
15  class ImageLayer : public Layer {
16  public:
17  ImageLayer(const pugi::xml_node& xml_node, TiledMap* tiledmap);
18  ~ImageLayer() override;
19 
20  auto getTexture() const -> const sf::Texture&;
21  auto getSize() const -> sf::Vector2i;
22  private:
23  std::string m_image_source;
24  int m_width;
25  int m_height;
26  sf::Texture* m_texture;
27 
28  void draw(sf::RenderTarget&, sf::RenderStates) const override;
29  };
30 }