TextureList.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "Array.h"
  3. #include "Critical.h"
  4. namespace Framework
  5. {
  6. class Texture; //! Texture.h
  7. //! Manages all loaded texture data so that multiple drawings can use
  8. //! the same data
  9. class TextureList : public virtual ReferenceCounter
  10. {
  11. private:
  12. int nextId;
  13. mutable ReadWriteLock lock;
  14. RCArray<Texture>* textures;
  15. RCArray<Text>* names;
  16. public:
  17. //! Constructor
  18. TextureList();
  19. //! Destructor
  20. ~TextureList();
  21. //! Adds a texture to the list
  22. //! \param t The texture
  23. //! \param name The name under which the texture is stored in the list
  24. DLLEXPORT bool addTexture(Texture* t, const char* name);
  25. //! Checks whether a texture is stored under a specific name
  26. //! \param name The name \return true if a texture with the name exists
  27. DLLEXPORT bool hasTexture(const char* name) const;
  28. //! Returns a specific texture
  29. //! \param name The name of the texture
  30. DLLEXPORT Texture* getTexture(const char* name) const;
  31. //! Returns a specific texture
  32. //! \param id The id of the texture
  33. DLLEXPORT Texture* getTexture(int id) const;
  34. //! Returns a specific texture without increased reference counter
  35. //! \param name The name of the texture
  36. DLLEXPORT Texture* zTexture(const char* name) const;
  37. //! Returns a specific texture without increased reference counter
  38. //! \param id The id of the texture
  39. DLLEXPORT Texture* zTexture(int id) const;
  40. //! Returns a list of all textures without increased reference counter
  41. DLLEXPORT const RCArray<Texture>* zTextures() const;
  42. };
  43. } // namespace Framework