You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

70 lines
1.5 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. #pragma once
  11. //
  12. // The TileSet class
  13. // -----------------
  14. // A TileSet is a collection of tiles stored in a texture. Texture uploading
  15. // and freeing is done in the render tick method. When the refcount drops to
  16. // zero, the texture is freed.
  17. //
  18. #include <lol/image/image.h>
  19. #include <lol/gpu/texture.h>
  20. #include <stdint.h>
  21. #include "engine/entity.h"
  22. namespace lol
  23. {
  24. class TextureImageData;
  25. class TextureImage : public Entity
  26. {
  27. typedef Entity super;
  28. protected:
  29. virtual TextureImageData* GetNewData();
  30. public:
  31. TextureImage(char const *path);
  32. TextureImage(char const *path, Image* image);
  33. virtual ~TextureImage();
  34. protected:
  35. void Init(char const *path);
  36. virtual void Init(char const *path, Image* image);
  37. protected:
  38. virtual void TickDraw(float seconds, Scene &scene);
  39. public:
  40. /* Inherited from Entity */
  41. virtual char const *GetName();
  42. void UpdateTexture(Image* image);
  43. Texture * GetTexture();
  44. Texture const * GetTexture() const;
  45. Image * GetImage();
  46. Image const * GetImage() const;
  47. ivec2 GetTextureSize() const;
  48. void Bind();
  49. void Unbind();
  50. protected:
  51. TextureImageData* m_data = nullptr;
  52. };
  53. } /* namespace lol */