raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::Texture Class Reference

Public Member Functions

 Texture ()
 
 Texture (const ::Image &image)
 
 Texture (const std::string &fileName)
 Load texture from file into GPU memory (VRAM) More...
 
 ~Texture ()
 
Texture & Draw ()
 Draws the texture at the top left corner of the screen. More...
 
Texture & Draw (::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin, float rotation=0, ::Color tint=WHITE)
 
Texture & Draw (::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin, float rotation=0, ::Color tint=WHITE)
 
Texture & Draw (::Rectangle sourceRec, ::Vector2 position, ::Color tint=WHITE)
 
Texture & Draw (::Vector2 position, ::Color tint=WHITE)
 
Texture & Draw (::Vector2 position, float rotation, float scale=1.0f, ::Color tint=WHITE)
 
Texture & Draw (::Vector2 tiling, ::Vector2 offset, ::Rectangle quad, ::Color tint=WHITE)
 
Texture & Draw (::Vector3 position, float width, float height, float length, ::Color color=WHITE)
 
Texture & Draw (int posX, int posY, ::Color tint=WHITE)
 
Texture & DrawTiled (::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin, float rotation, float scale, Color tint=WHITE)
 
Texture & GenMipmaps ()
 Generate GPU mipmaps for a texture. More...
 
int GetFormat () const
 
int GetHeight () const
 
unsigned int GetId () const
 
int GetMipmaps () const
 
Image GetTextureData () const
 Get pixel data from GPU texture and return an Image. More...
 
int GetWidth () const
 
void Load (const std::string &fileName)
 Load texture from file into GPU memory (VRAM) More...
 
void LoadFromImage (const ::Image &image)
 Load texture from image data. More...
 
void LoadTextureCubemap (const ::Image &image, int layoutType)
 Load cubemap from image, multiple image cubemap layouts supported. More...
 
 operator raylib::Image ()
 Get pixel data from GPU texture and return an Image. More...
 
Texture & operator= (const ::Texture &texture)
 
Texture & operator= (const Texture &texture)
 
Texture & SetFilter (int filterMode)
 Set texture scaling filter mode. More...
 
void SetFormat (int value)
 
void SetHeight (int value)
 
void SetId (unsigned int value)
 
Texture & SetMaterial (::Material *material, int mapType)
 Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...) More...
 
void SetMipmaps (int value)
 
Texture & SetShapesTexture (Rectangle source)
 Define default texture used to draw shapes. More...
 
void SetWidth (int value)
 
Texture & SetWrap (int wrapMode)
 Set texture wrapping mode. More...
 
void Unload ()
 Unload texture from GPU memory (VRAM) More...
 
Texture & Update (const void *pixels)
 Update GPU texture with new data. More...
 
Texture & UpdateRec (::Rectangle rec, const void *pixels)
 Update GPU texture rectangle with new data. More...
 

Static Public Member Functions

static int GetPixelDataSize (int width, int height, int format)
 Get pixel data size in bytes for certain format. More...
 

Protected Member Functions

void set (::Texture texture)
 

Detailed Description

Definition at line 36 of file Texture.hpp.

Constructor & Destructor Documentation

◆ Texture() [1/3]

raylib::Texture::Texture ( )
inline

Definition at line 38 of file Texture.hpp.

References set().

◆ Texture() [2/3]

raylib::Texture::Texture ( const ::Image &  image)
inline

Definition at line 42 of file Texture.hpp.

References LoadFromImage().

◆ Texture() [3/3]

raylib::Texture::Texture ( const std::string &  fileName)
inline

Load texture from file into GPU memory (VRAM)

Definition at line 49 of file Texture.hpp.

References Load().

◆ ~Texture()

raylib::Texture::~Texture ( )
inline

Definition at line 53 of file Texture.hpp.

References Unload().

Member Function Documentation

◆ Draw() [1/9]

Texture& raylib::Texture::Draw ( )
inline

Draws the texture at the top left corner of the screen.

Definition at line 158 of file Texture.hpp.

◆ Draw() [2/9]

Texture& raylib::Texture::Draw ( ::NPatchInfo  nPatchInfo,
::Rectangle  destRec,
::Vector2  origin,
float  rotation = 0,
::Color  tint = WHITE 
)
inline

Definition at line 196 of file Texture.hpp.

◆ Draw() [3/9]

Texture& raylib::Texture::Draw ( ::Rectangle  sourceRec,
::Rectangle  destRec,
::Vector2  origin,
float  rotation = 0,
::Color  tint = WHITE 
)
inline

Definition at line 190 of file Texture.hpp.

◆ Draw() [4/9]

Texture& raylib::Texture::Draw ( ::Rectangle  sourceRec,
::Vector2  position,
::Color  tint = WHITE 
)
inline

Definition at line 179 of file Texture.hpp.

◆ Draw() [5/9]

Texture& raylib::Texture::Draw ( ::Vector2  position,
::Color  tint = WHITE 
)
inline

Definition at line 168 of file Texture.hpp.

◆ Draw() [6/9]

Texture& raylib::Texture::Draw ( ::Vector2  position,
float  rotation,
float  scale = 1.0f,
::Color  tint = WHITE 
)
inline

Definition at line 173 of file Texture.hpp.

◆ Draw() [7/9]

Texture& raylib::Texture::Draw ( ::Vector2  tiling,
::Vector2  offset,
::Rectangle  quad,
::Color  tint = WHITE 
)
inline

Definition at line 184 of file Texture.hpp.

◆ Draw() [8/9]

Texture& raylib::Texture::Draw ( ::Vector3  position,
float  width,
float  height,
float  length,
::Color  color = WHITE 
)
inline

Definition at line 202 of file Texture.hpp.

◆ Draw() [9/9]

Texture& raylib::Texture::Draw ( int  posX,
int  posY,
::Color  tint = WHITE 
)
inline

Definition at line 163 of file Texture.hpp.

◆ DrawTiled()

Texture& raylib::Texture::DrawTiled ( ::Rectangle  sourceRec,
::Rectangle  destRec,
::Vector2  origin,
float  rotation,
float  scale,
Color  tint = WHITE 
)
inline

Definition at line 208 of file Texture.hpp.

◆ GenMipmaps()

Texture& raylib::Texture::GenMipmaps ( )
inline

Generate GPU mipmaps for a texture.

Definition at line 134 of file Texture.hpp.

◆ GetFormat()

int raylib::Texture::GetFormat ( ) const
inline

Definition at line 61 of file Texture.hpp.

◆ GetHeight()

int raylib::Texture::GetHeight ( ) const
inline

Definition at line 59 of file Texture.hpp.

◆ GetId()

unsigned int raylib::Texture::GetId ( ) const
inline

Definition at line 57 of file Texture.hpp.

◆ GetMipmaps()

int raylib::Texture::GetMipmaps ( ) const
inline

Definition at line 60 of file Texture.hpp.

◆ GetPixelDataSize()

static int raylib::Texture::GetPixelDataSize ( int  width,
int  height,
int  format 
)
inlinestatic

Get pixel data size in bytes for certain format.

Definition at line 225 of file Texture.hpp.

◆ GetTextureData()

Image raylib::Texture::GetTextureData ( ) const
inline

Get pixel data from GPU texture and return an Image.

Definition at line 120 of file Texture.hpp.

Referenced by operator raylib::Image().

◆ GetWidth()

int raylib::Texture::GetWidth ( ) const
inline

Definition at line 58 of file Texture.hpp.

◆ Load()

void raylib::Texture::Load ( const std::string &  fileName)
inline

Load texture from file into GPU memory (VRAM)

Definition at line 90 of file Texture.hpp.

References set().

Referenced by Texture().

◆ LoadFromImage()

void raylib::Texture::LoadFromImage ( const ::Image &  image)
inline

Load texture from image data.

Definition at line 76 of file Texture.hpp.

References set().

Referenced by Texture().

◆ LoadTextureCubemap()

void raylib::Texture::LoadTextureCubemap ( const ::Image &  image,
int  layoutType 
)
inline

Load cubemap from image, multiple image cubemap layouts supported.

Definition at line 83 of file Texture.hpp.

References set().

◆ operator raylib::Image()

raylib::Texture::operator raylib::Image ( )
inline

Get pixel data from GPU texture and return an Image.

Definition at line 127 of file Texture.hpp.

References GetTextureData().

◆ operator=() [1/2]

Texture& raylib::Texture::operator= ( const ::Texture &  texture)
inline

Definition at line 63 of file Texture.hpp.

References set().

◆ operator=() [2/2]

Texture& raylib::Texture::operator= ( const Texture &  texture)
inline

Definition at line 68 of file Texture.hpp.

References set().

◆ set()

void raylib::Texture::set ( ::Texture  texture)
inlineprotected

Definition at line 238 of file Texture.hpp.

Referenced by Load(), LoadFromImage(), LoadTextureCubemap(), operator=(), and Texture().

◆ SetFilter()

Texture& raylib::Texture::SetFilter ( int  filterMode)
inline

Set texture scaling filter mode.

Definition at line 142 of file Texture.hpp.

◆ SetFormat()

void raylib::Texture::SetFormat ( int  value)
inline

Definition at line 61 of file Texture.hpp.

◆ SetHeight()

void raylib::Texture::SetHeight ( int  value)
inline

Definition at line 59 of file Texture.hpp.

◆ SetId()

void raylib::Texture::SetId ( unsigned int  value)
inline

Definition at line 57 of file Texture.hpp.

◆ SetMaterial()

Texture& raylib::Texture::SetMaterial ( ::Material *  material,
int  mapType 
)
inline

Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)

Definition at line 217 of file Texture.hpp.

◆ SetMipmaps()

void raylib::Texture::SetMipmaps ( int  value)
inline

Definition at line 60 of file Texture.hpp.

◆ SetShapesTexture()

Texture& raylib::Texture::SetShapesTexture ( Rectangle  source)
inline

Define default texture used to draw shapes.

Definition at line 232 of file Texture.hpp.

◆ SetWidth()

void raylib::Texture::SetWidth ( int  value)
inline

Definition at line 58 of file Texture.hpp.

◆ SetWrap()

Texture& raylib::Texture::SetWrap ( int  wrapMode)
inline

Set texture wrapping mode.

Definition at line 150 of file Texture.hpp.

◆ Unload()

void raylib::Texture::Unload ( )
inline

Unload texture from GPU memory (VRAM)

Definition at line 97 of file Texture.hpp.

Referenced by ~Texture().

◆ Update()

Texture& raylib::Texture::Update ( const void *  pixels)
inline

Update GPU texture with new data.

Definition at line 104 of file Texture.hpp.

◆ UpdateRec()

Texture& raylib::Texture::UpdateRec ( ::Rectangle  rec,
const void *  pixels 
)
inline

Update GPU texture rectangle with new data.

Definition at line 112 of file Texture.hpp.