Texture.h 827 B

12345678910111213141516171819202122232425262728293031
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #include <string>
  9. class Texture
  10. {
  11. public:
  12. Texture();
  13. ~Texture();
  14. bool Load(const std::string& fileName);
  15. void Unload();
  16. void CreateFromSurface(struct SDL_Surface* surface);
  17. void CreateForRendering(int width, int height, unsigned int format);
  18. void SetActive(int index = 0);
  19. int GetWidth() const { return mWidth; }
  20. int GetHeight() const { return mHeight; }
  21. unsigned int GetTextureID() const { return mTextureID; }
  22. private:
  23. unsigned int mTextureID;
  24. int mWidth;
  25. int mHeight;
  26. };