TDME2  1.9.200
TextureManager_TextureManaged.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
7 
9 
10 using std::string;
11 
12 /**
13  * Managed texture entity
14  * @author Andreas Drewke
15  */
17 {
18  friend class TextureManager;
19 
20 private:
21  string id;
22  int32_t rendererId;
23  int32_t referenceCounter { 0 };
24  volatile bool uploaded { false };
25 
26 private:
27  // forbid class copy
29 
30  /**
31  * Protected constructor
32  * @param id id
33  * @param rendererId renderer id
34  */
35  TextureManager_TextureManaged(const string& id, int32_t rendererId);
36 
37  /**
38  * @return texture id
39  */
40  inline const string& getId() {
41  return id;
42  }
43 
44  /**
45  * @return reference counter
46  */
47  inline int32_t getReferenceCounter() {
48  return referenceCounter;
49  }
50 
51  /**
52  * decrement reference counter
53  * @return if reference counter = 0
54  */
55  inline bool decrementReferenceCounter() {
57  return referenceCounter == 0;
58  }
59 
60  /**
61  * increment reference counter
62  */
63  inline void incrementReferenceCounter() {
65  }
66 
67 public:
68  /**
69  * @return texture renderer id
70  */
71  inline int32_t getRendererId() {
72  return rendererId;
73  }
74 
75  /**
76  * Set uploaded
77  * @param uploaded uploaded
78  */
79  inline void setUploaded(bool uploaded) {
80  this->uploaded = uploaded;
81  }
82 
83  /**
84  * @return if texture has been uploaded
85  */
86  inline bool isUploaded() {
87  return uploaded;
88  }
89 
90 };
TextureManager_TextureManaged(const string &id, int32_t rendererId)
Protected constructor.
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6