TextureList.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. static int id;
  13. static Critical cs;
  14. RCArray<Texture>* textures;
  15. RCArray<Text>* names;
  16. public:
  17. //! Constructor
  18. TextureList();
  19. //! Destructor
  20. ~TextureList();
  21. //! Deletes all textures
  22. DLLEXPORT void clear();
  23. //! Adds a texture to the list
  24. //! \param t The texture
  25. //! \param name The name under which the texture is stored in the list
  26. DLLEXPORT bool addTexture(Texture* t, const char* name);
  27. //! Removes a texture from the list
  28. //! \param name The name of the texture
  29. DLLEXPORT void removeTexture(const char* name);
  30. //! Checks whether a texture is stored under a specific name
  31. //! \param name The name \return true if a texture with the name exists
  32. DLLEXPORT bool hasTexture(const char* name) const;
  33. //! Returns a specific texture
  34. //! \param name The name of the texture
  35. DLLEXPORT Texture* getTexture(const char* name) const;
  36. //! Returns a specific texture
  37. //! \param id The id of the texture
  38. DLLEXPORT Texture* getTexture(int id) const;
  39. //! Returns a specific texture without increased reference counter
  40. //! \param name The name of the texture
  41. DLLEXPORT Texture* zTexture(const char* name) const;
  42. //! Returns a specific texture without increased reference counter
  43. //! \param id The id of the texture
  44. DLLEXPORT Texture* zTexture(int id) const;
  45. //! Initializes static private members. Called automatically by the
  46. //! framework.
  47. static void init();
  48. //! Deletes static private members. Called automatically by the
  49. //! framework.
  50. static void destroy();
  51. };
  52. } // namespace Framework