TexturList.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include "Array.h"
  3. #include "Critical.h"
  4. namespace Framework
  5. {
  6. class Textur; //! Textur.h
  7. //! Verwaltet alle geladenen Texturdaten, so dass mehrere Zeichnungen die selben Daten benutzen können
  8. class TexturList
  9. {
  10. private:
  11. static int id;
  12. static Critical cs;
  13. RCArray< Textur > *textures;
  14. RCArray< Text > *names;
  15. int ref;
  16. public:
  17. //! Konstruktor
  18. TexturList();
  19. //! Destruktor
  20. ~TexturList();
  21. //! Löscht alle Texturen
  22. DLLEXPORT void leeren();
  23. //! Fügt der Liste eine Textur hinzu
  24. //! \param t Die Textur
  25. //! \param name Der name, unter dem die Textur in der Liste gespeichert wird
  26. DLLEXPORT bool addTextur( Textur *t, const char *name );
  27. //! Entfernt eine Textur aus der Liste
  28. //! \param name Der Name der Textur
  29. DLLEXPORT void removeTextur( const char *name );
  30. //! Überprüft, ob unter einem bestimmten Namen eine Textur abgespeichert wurde
  31. //! \param name Der Name
  32. //! \return true, wenn eine Textur mit dem Namen existiert
  33. DLLEXPORT bool hatTextur( const char *name ) const;
  34. //! Gibt eine bestimmte Textur zurück
  35. //! \param name Der Name der Textur
  36. DLLEXPORT Textur *getTextur( const char *name ) const;
  37. //! Gibt eine bestimmte Textur zurück
  38. //! \param id Die Id der Textur
  39. DLLEXPORT Textur *getTextur( int id ) const;
  40. //! Gibt eine bestimmte Textur ohne erhöhten Reference Counter zurück
  41. //! \param name Der Name der Textur
  42. DLLEXPORT Textur *zTextur( const char *name ) const;
  43. //! Gibt eine bestimmte Textur ohne erhöhten Reference Counter zurück
  44. //! \param id Die Id der Textur
  45. DLLEXPORT Textur *zTextur( int id ) const;
  46. //! Erhöht den Reference Counting Zähler.
  47. //! \return this.
  48. DLLEXPORT TexturList *getThis();
  49. //! Verringert den Reference Counting Zähler. Wenn der Zähler 0 erreicht, wird das Zeichnung automatisch gelöscht.
  50. //! \return 0.
  51. DLLEXPORT TexturList *release();
  52. //! Initialisiert statische private member. Wird vom Framework automatisch aufgerufen.
  53. static void init();
  54. //! Löscht statische private member. Wird vom Framework automatisch aufgerufen.
  55. static void destroy();
  56. };
  57. }