Claire's Game Engine
Full C++ Engine using OpenGL
|
Texture is a wrapper for SDL and OpenGL texture loading, management, and activation. It abstracts differences between SDL and OpenGL renderers for texture creation and usage. More...
#include <Texture.h>
Public Member Functions | |
bool | Load (IRenderer &pRenderer, const std::string &pFileName) |
Loads a texture file using the appropriate renderer (SDL or OpenGL). | |
void | Unload () |
Frees resources associated with the texture. | |
void | SetActive (int slot) const |
Binds the texture as the currently active OpenGL texture. Note: This only applies to OpenGL renderers. | |
void | UpdateInfo (int &pWidthOut, int &pHeightOut) |
Outputs the texture dimensions to the given references. | |
void | SetTextureSize (int width, int height) |
Manually sets the size of the texture. | |
int | GetWidth () const |
Gets the texture width. | |
int | GetHeight () const |
Gets the texture height. | |
SDL_Texture * | GetSDLTexture () const |
Gets the internal SDL texture pointer (only valid for SDL renderer). | |
Texture is a wrapper for SDL and OpenGL texture loading, management, and activation. It abstracts differences between SDL and OpenGL renderers for texture creation and usage.
int Texture::GetHeight | ( | ) | const |
Gets the texture height.
SDL_Texture * Texture::GetSDLTexture | ( | ) | const |
Gets the internal SDL texture pointer (only valid for SDL renderer).
int Texture::GetWidth | ( | ) | const |
Gets the texture width.
bool Texture::Load | ( | IRenderer & | pRenderer, |
const std::string & | pFileName ) |
Loads a texture file using the appropriate renderer (SDL or OpenGL).
pRenderer | Reference to the renderer (determines backend). |
pFileName | Path to the texture image file. |
void Texture::SetActive | ( | int | slot | ) | const |
Binds the texture as the currently active OpenGL texture. Note: This only applies to OpenGL renderers.
void Texture::SetTextureSize | ( | int | width, |
int | height ) |
Manually sets the size of the texture.
width | New width. |
height | New height. |
void Texture::Unload | ( | ) |
Frees resources associated with the texture.
void Texture::UpdateInfo | ( | int & | pWidthOut, |
int & | pHeightOut ) |
Outputs the texture dimensions to the given references.
pWidthOut | Receives texture width. |
pHeightOut | Receives texture height. |