Night Byte
SpriteSheet.hpp
1 #pragma once
2 
3 #include <SDL_render.h>
4 #include <SDL_image.h>
5 #include <string>
6 #include "../../Libraries/json.hpp"
7 
8 class SpriteSheet {
9 public:
10  SpriteSheet(const std::string &path,
11  std::string &spriteSheetId,
12  int width,
13  int height,
14  float offsetX,
15  float offsetY,
16  SDL_Renderer &renderer);
17 
18  SpriteSheet(const std::string &path, const std::string &jsonPath, std::string &spriteSheetId, SDL_Renderer &renderer);
19 
20  ~SpriteSheet();
21 
22  void drawSelectedSprite(float x, float y, float scale = 1, float rotation = 0);
23 
24  void selectSprite(int x, int y);
25 
26  void selectSprite(const std::string &spriteName);
27 
28  inline const std::string& getTextureId() {
29  return textureId;
30  }
31 
32  inline const SDL_Rect &getClip() {
33  return m_clip;
34  }
35 
36 private:
37  SDL_Rect m_clip{};
38  std::string textureId;
39  SDL_Renderer &_sdlRenderer;
40 };
xml_schema::string
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: common.hxx:255
SpriteSheet
Definition: SpriteSheet.hpp:8