TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
tb_texture_manager.h
1 
10 #ifndef _TurtleBraines_TextureManager_h_
11 #define _TurtleBraines_TextureManager_h_
12 
13 #include "../core/tb_noncopyable.h"
14 #include "../core/tb_string.h"
15 #include "../core/tb_types.h"
16 
17 #include <cstddef>
18 
19 namespace TurtleBrains
20 {
21  namespace Graphics
22  {
23 
27  typedef float TexelSpace;
28 
34 
41  typedef unsigned int TextureHandle;
42 
46  extern const TextureHandle kInvalidTexture;
47 
63  {
64  public:
69  TextureManager(void);
70 
75  ~TextureManager(void);
76 
85  TextureHandle CreateTextureFromFile(const tbCore::tbString& filename);
86 
97  TextureHandle CreateTextureFromFileData(const unsigned char* fileDataInMemory, const size_t& fileSizeInBytes);
98 
111  TextureHandle CreateTextureFromPixelData(const unsigned char* pixelData, const PixelSpace& textureWidth, const PixelSpace& textureHeight);
112 
122  TextureHandle CreateTextureReference(const TextureHandle& textureHandle);
123 
131  void DestroyTexture(const TextureHandle& textureHandle);
132 
140  void BindTexture(const TextureHandle& textureHandle);
141 
147  PixelSpace GetTextureWidth(const TextureHandle& textureHandle) const;
148 
154  PixelSpace GetTextureHeight(const TextureHandle& textureHandle) const;
155 
156  private:
157  TextureHandle mBoundTexture;
158  };
159 
165 
166  }; /* namespace Graphics */
167 }; /* namespace TurtleBrains */
168 
170 
171 #endif /* _TurtleBraines_TextureManager_h_ */
PixelSpace GetTextureWidth(const TextureHandle &textureHandle) const
TextureHandle CreateTextureReference(const TextureHandle &textureHandle)
Definition: tb_texture_manager.h:62
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
TextureHandle CreateTextureFromFile(const tbCore::tbString &filename)
uint16_t uint16
Unsigned integer with a size of 16 bits. Supports values from 0 to 65535.
Definition: tb_types.h:25
void BindTexture(const TextureHandle &textureHandle)
unsigned int TextureHandle
Definition: tb_texture_manager.h:41
Definition: tb_noncopyable.h:22
Contains all functions, classes and helpers related to game/application development written by Tim "B...
Definition: tb_application_dialog.h:21
TextureHandle CreateTextureFromFileData(const unsigned char *fileDataInMemory, const size_t &fileSizeInBytes)
void DestroyTexture(const TextureHandle &textureHandle)
TextureManager theTextureManager
const TextureHandle kInvalidTexture
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.h:33
PixelSpace GetTextureHeight(const TextureHandle &textureHandle) const
float TexelSpace
Definition: tb_texture_manager.h:27
std::string tbString
Definition: tb_string.h:293
TextureHandle CreateTextureFromPixelData(const unsigned char *pixelData, const PixelSpace &textureWidth, const PixelSpace &textureHeight)