Texture.h 686 B

1234567891011121314151617181920212223242526272829
  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 SetActive();
  18. int GetWidth() const { return mWidth; }
  19. int GetHeight() const { return mHeight; }
  20. private:
  21. unsigned int mTextureID;
  22. int mWidth;
  23. int mHeight;
  24. };