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

Texture type. More...

Public Member Functions

 Texture (const ::Image &image)
 
 Texture (const ::Image &image, int layout)
 Load cubemap from image, multiple image cubemap layouts supported. More...
 
 Texture (const ::Texture &texture)
 
 Texture (const std::string &fileName)
 Load texture from file into GPU memory (VRAM)
 
Texture & Draw ()
 Draws the texture at the top left corner of the screen.
 
Texture & Draw (::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin={0, 0}, float rotation=0, ::Color tint={255, 255, 255, 255})
 
Texture & Draw (::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin={0, 0}, float rotation=0, ::Color tint={255, 255, 255, 255})
 
Texture & Draw (::Rectangle sourceRec, ::Vector2 position={0, 0}, ::Color tint={255, 255, 255, 255})
 
Texture & Draw (::Vector2 position, ::Color tint={255, 255, 255, 255})
 
Texture & Draw (::Vector2 position, float rotation, float scale=1.0f, ::Color tint={255, 255, 255, 255})
 
Texture & Draw (::Vector2 tiling, ::Vector2 offset, ::Rectangle quad, ::Color tint={255, 255, 255, 255})
 
Texture & Draw (::Vector3 position, float width, float height, float length, ::Color tint={255, 255, 255, 255})
 
Texture & Draw (int posX, int posY, ::Color tint={255, 255, 255, 255})
 Draw a Texture2D.
 
Texture & DrawPoly (Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint={255, 255, 255, 255})
 
Texture & DrawTiled (::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin={0, 0}, float rotation=0, float scale=1, Color tint={255, 255, 255, 255})
 
Texture & GenMipmaps ()
 Generate GPU mipmaps for a texture.
 
inline ::Image GetData () const
 Get pixel data from GPU texture and return an Image.
 
int GetFormat () const
 Retrieves the format value for the object. More...
 
int GetHeight () const
 Retrieves the height value for the object. More...
 
unsigned int GetId () const
 Retrieves the id value for the object. More...
 
int GetMipmaps () const
 Retrieves the mipmaps value for the object. More...
 
inline ::Vector2 GetSize ()
 Retrieve the width and height of the texture.
 
int GetWidth () const
 Retrieves the width value for the object. More...
 
void Load (const std::string &fileName)
 Load texture from file into GPU memory (VRAM)
 
void LoadCubemap (const ::Image &image, int layoutType)
 Load cubemap from image, multiple image cubemap layouts supported.
 
void LoadFromImage (const ::Image &image)
 Load texture from image data.
 
 operator raylib::Image ()
 Get pixel data from GPU texture and return an Image.
 
Texture & operator= (const ::Texture &texture)
 
Texture & SetFilter (int filterMode)
 Set texture scaling filter mode.
 
void SetFormat (int value)
 Sets the format value for the object. More...
 
void SetHeight (int value)
 Sets the height value for the object. More...
 
void SetId (unsigned int value)
 Sets the id value for the object. More...
 
Texture & SetMaterial (::Material *material, int mapType=MATERIAL_MAP_NORMAL)
 Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
 
Texture & SetMaterial (const ::Material &material, int mapType=MATERIAL_MAP_NORMAL)
 
void SetMipmaps (int value)
 Sets the mipmaps value for the object. More...
 
void SetWidth (int value)
 Sets the width value for the object. More...
 
Texture & SetWrap (int wrapMode)
 Set texture wrapping mode.
 
void Unload ()
 Unload texture from GPU memory (VRAM)
 
Texture & Update (const void *pixels)
 Update GPU texture with new data.
 
Texture & UpdateRec (::Rectangle rec, const void *pixels)
 Update GPU texture rectangle with new data.
 

Detailed Description

Texture type.

Definition at line 15 of file Texture.hpp.

Constructor & Destructor Documentation

◆ Texture()

raylib::Texture::Texture ( const ::Image &  image,
int  layout 
)
inline

Load cubemap from image, multiple image cubemap layouts supported.

See also
LoadTextureCubemap()

Definition at line 30 of file Texture.hpp.

References LoadCubemap().

Member Function Documentation

◆ GetFormat()

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

Retrieves the format value for the object.

Returns
The format value of the object.

Definition at line 49 of file Texture.hpp.

◆ GetHeight()

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

Retrieves the height value for the object.

Returns
The height value of the object.

Definition at line 47 of file Texture.hpp.

◆ GetId()

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

Retrieves the id value for the object.

Returns
The id value of the object.

Definition at line 45 of file Texture.hpp.

◆ GetMipmaps()

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

Retrieves the mipmaps value for the object.

Returns
The mipmaps value of the object.

Definition at line 48 of file Texture.hpp.

◆ GetWidth()

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

Retrieves the width value for the object.

Returns
The width value of the object.

Definition at line 46 of file Texture.hpp.

◆ SetFormat()

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

Sets the format value for the object.

Parameters
valueThe value of which to set format to.

Definition at line 49 of file Texture.hpp.

◆ SetHeight()

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

Sets the height value for the object.

Parameters
valueThe value of which to set height to.

Definition at line 47 of file Texture.hpp.

◆ SetId()

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

Sets the id value for the object.

Parameters
valueThe value of which to set id to.

Definition at line 45 of file Texture.hpp.

◆ SetMipmaps()

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

Sets the mipmaps value for the object.

Parameters
valueThe value of which to set mipmaps to.

Definition at line 48 of file Texture.hpp.

◆ SetWidth()

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

Sets the width value for the object.

Parameters
valueThe value of which to set width to.

Definition at line 46 of file Texture.hpp.