raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
raylib::TextureUnmanaged Class Reference

A Texture that is not managed by C++ RAII. More...

#include <TextureUnmanaged.hpp>

Public Member Functions

 TextureUnmanaged ()
 Default texture constructor. More...
 
 TextureUnmanaged (::Texture &&other)
 
 TextureUnmanaged (const ::Image &image)
 Creates a texture from the given Image. More...
 
 TextureUnmanaged (const ::Image &image, int layout)
 Load cubemap from image, multiple image cubemap layouts supported. More...
 
 TextureUnmanaged (const ::Texture &texture)
 Creates a texture object based on the given Texture struct data. More...
 
 TextureUnmanaged (const std::string_view fileName)
 Load texture from file into GPU memory (VRAM) More...
 
 TextureUnmanaged (unsigned int id, int width, int height, int mipmaps=1, int format=PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
 Move/Create a texture structure manually. More...
 
void Draw (::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin={0, 0}, Radian rotation=0, ::Color tint={255, 255, 255, 255}) const
 Draws a texture (or part of it) that stretches or shrinks nicely. More...
 
void Draw (::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin={0, 0}, Degree rotation=0, ::Color tint={255, 255, 255, 255}) const
 Draw a part of a texture defined by a rectangle with 'pro' parameters. More...
 
void Draw (::Rectangle sourceRec, ::Vector2 position={0, 0}, ::Color tint={255, 255, 255, 255}) const
 Draw a part of a texture defined by a rectangle. More...
 
void Draw (::Vector2 position, ::Color tint={255, 255, 255, 255}) const
 Draw a Texture2D with position defined as Vector2. More...
 
void Draw (::Vector2 position, Degree rotation, float scale=1.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a Texture2D with extended parameters. More...
 
void Draw (int posX=0, int posY=0, ::Color tint={255, 255, 255, 255}) const
 Draw a Texture2D. More...
 
void DrawBillboard (const ::Camera &camera, ::Rectangle source, ::Vector3 position, ::Vector2 size, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture defined by source. More...
 
void DrawBillboard (const ::Camera &camera, ::Rectangle source, Vector3 position, ::Vector3 up, Vector2 size, Vector2 origin, Degree rotation=0.0f, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture defined by source and rotation. More...
 
void DrawBillboard (const ::Camera &camera, ::Vector3 position, float size, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture. More...
 
TextureUnmanagedGenMipmaps ()
 Generate GPU mipmaps for a texture. More...
 
Image GetData () const
 Get pixel data from GPU texture and return an Image. More...
 
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...
 
Vector2 GetSize () const
 Retrieve the width and height of the texture. More...
 
int GetWidth () const
 Retrieves the width value for the object. More...
 
bool IsValid () const
 Determines whether or not the Texture has been loaded and is ready. More...
 
void Load (const ::Image &image)
 Load texture from image data. More...
 
void Load (const ::Image &image, int layoutType)
 Load cubemap from image, multiple image cubemap layouts supported. More...
 
void Load (const std::string_view fileName)
 Load texture from file into GPU memory (VRAM) More...
 
 operator Image ()
 Get pixel data from GPU texture and return an Image. More...
 
TextureUnmanagedoperator= (const ::Texture &texture)
 
TextureUnmanagedSetFilter (int filterMode)
 Set texture scaling filter mode. More...
 
TextureUnmanagedSetMaterial (::Material *material, int mapType=MATERIAL_MAP_NORMAL)
 Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...) More...
 
TextureUnmanagedSetMaterial (const ::Material &material, int mapType=MATERIAL_MAP_NORMAL)
 
TextureUnmanagedSetShaderValue (const ::Shader &shader, int locIndex)
 Set shader uniform value for texture (sampler2d) More...
 
TextureUnmanagedSetShapes (const ::Rectangle &source)
 Set texture and rectangle to be used on shapes drawing. More...
 
TextureUnmanagedSetWrap (int wrapMode)
 Set texture wrapping mode. More...
 
void Unload ()
 Unload texture from GPU memory (VRAM) More...
 
TextureUnmanagedUpdate (::Rectangle rec, const void *pixels)
 Update GPU texture rectangle with new data. More...
 
TextureUnmanagedUpdate (const void *pixels)
 Update GPU texture with new data. More...
 

Protected Member Functions

void set (const ::Texture &texture)
 

Detailed Description

A Texture that is not managed by C++ RAII.

Make sure to Unload() this if needed, otherwise use raylib::Texture.

See also
raylib::Texture

Definition at line 21 of file TextureUnmanaged.hpp.

Constructor & Destructor Documentation

◆ TextureUnmanaged() [1/7]

raylib::TextureUnmanaged::TextureUnmanaged ( )
inline

Default texture constructor.

Definition at line 26 of file TextureUnmanaged.hpp.

◆ TextureUnmanaged() [2/7]

raylib::TextureUnmanaged::TextureUnmanaged ( unsigned int  id,
int  width,
int  height,
int  mipmaps = 1,
int  format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 
)
inline

Move/Create a texture structure manually.

Definition at line 33 of file TextureUnmanaged.hpp.

◆ TextureUnmanaged() [3/7]

raylib::TextureUnmanaged::TextureUnmanaged ( const ::Texture &  texture)
inline

Creates a texture object based on the given Texture struct data.

Definition at line 46 of file TextureUnmanaged.hpp.

◆ TextureUnmanaged() [4/7]

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

Creates a texture from the given Image.

Exceptions
raylib::RaylibExceptionThrows if failed to create the texture from the given image.

Definition at line 56 of file TextureUnmanaged.hpp.

References Load().

◆ TextureUnmanaged() [5/7]

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

Load cubemap from image, multiple image cubemap layouts supported.

Exceptions
raylib::RaylibExceptionThrows if failed to create the texture from the given cubemap.
See also
LoadTextureCubemap()

Definition at line 65 of file TextureUnmanaged.hpp.

References Load().

◆ TextureUnmanaged() [6/7]

raylib::TextureUnmanaged::TextureUnmanaged ( const std::string_view  fileName)
inline

Load texture from file into GPU memory (VRAM)

Exceptions
raylib::RaylibExceptionThrows if failed to create the texture from the given file.

Definition at line 72 of file TextureUnmanaged.hpp.

References Load().

◆ TextureUnmanaged() [7/7]

raylib::TextureUnmanaged::TextureUnmanaged ( ::Texture &&  other)
inline

Definition at line 76 of file TextureUnmanaged.hpp.

Member Function Documentation

◆ Draw() [1/6]

void raylib::TextureUnmanaged::Draw ( ::NPatchInfo  nPatchInfo,
::Rectangle  destRec,
::Vector2  origin = {0, 0},
Radian  rotation = 0,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draws a texture (or part of it) that stretches or shrinks nicely.

See also
::DrawTextureNPatch()

Definition at line 241 of file TextureUnmanaged.hpp.

◆ Draw() [2/6]

void raylib::TextureUnmanaged::Draw ( ::Rectangle  sourceRec,
::Rectangle  destRec,
::Vector2  origin = {0, 0},
Degree  rotation = 0,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a part of a texture defined by a rectangle with 'pro' parameters.

See also
::DrawTexturePro()

Definition at line 231 of file TextureUnmanaged.hpp.

◆ Draw() [3/6]

void raylib::TextureUnmanaged::Draw ( ::Rectangle  sourceRec,
::Vector2  position = {0, 0},
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a part of a texture defined by a rectangle.

See also
::DrawTextureRec()

Definition at line 222 of file TextureUnmanaged.hpp.

◆ Draw() [4/6]

void raylib::TextureUnmanaged::Draw ( ::Vector2  position,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a Texture2D with position defined as Vector2.

See also
::DrawTextureV()

Definition at line 205 of file TextureUnmanaged.hpp.

◆ Draw() [5/6]

void raylib::TextureUnmanaged::Draw ( ::Vector2  position,
Degree  rotation,
float  scale = 1.0f,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a Texture2D with extended parameters.

See also
::DrawTextureEx()

Definition at line 212 of file TextureUnmanaged.hpp.

◆ Draw() [6/6]

void raylib::TextureUnmanaged::Draw ( int  posX = 0,
int  posY = 0,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a Texture2D.

See also
::DrawTexture()

Definition at line 196 of file TextureUnmanaged.hpp.

◆ DrawBillboard() [1/3]

void raylib::TextureUnmanaged::DrawBillboard ( const ::Camera &  camera,
::Rectangle  source,
::Vector3  position,
::Vector2  size,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a billboard texture defined by source.

See also
::DrawBillboardRec()

Definition at line 261 of file TextureUnmanaged.hpp.

◆ DrawBillboard() [2/3]

void raylib::TextureUnmanaged::DrawBillboard ( const ::Camera &  camera,
::Rectangle  source,
Vector3  position,
::Vector3  up,
Vector2  size,
Vector2  origin,
Degree  rotation = 0.0f,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a billboard texture defined by source and rotation.

See also
::DrawBillboardPro()

Definition at line 275 of file TextureUnmanaged.hpp.

◆ DrawBillboard() [3/3]

void raylib::TextureUnmanaged::DrawBillboard ( const ::Camera &  camera,
::Vector3  position,
float  size,
::Color  tint = {255, 255, 255, 255} 
) const
inline

Draw a billboard texture.

See also
DrawBillboard()

Definition at line 252 of file TextureUnmanaged.hpp.

◆ GenMipmaps()

TextureUnmanaged & raylib::TextureUnmanaged::GenMipmaps ( )
inline

Generate GPU mipmaps for a texture.

Definition at line 170 of file TextureUnmanaged.hpp.

◆ GetData()

Image raylib::TextureUnmanaged::GetData ( ) const
inline

Get pixel data from GPU texture and return an Image.

Definition at line 158 of file TextureUnmanaged.hpp.

Referenced by operator Image().

◆ GetFormat()

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

Retrieves the format value for the object.

Returns
The format value of the object.

Definition at line 84 of file TextureUnmanaged.hpp.

◆ GetHeight()

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

Retrieves the height value for the object.

Returns
The height value of the object.

Definition at line 82 of file TextureUnmanaged.hpp.

◆ GetId()

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

Retrieves the id value for the object.

Returns
The id value of the object.

Definition at line 80 of file TextureUnmanaged.hpp.

◆ GetMipmaps()

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

Retrieves the mipmaps value for the object.

Returns
The mipmaps value of the object.

Definition at line 83 of file TextureUnmanaged.hpp.

◆ GetSize()

Vector2 raylib::TextureUnmanaged::GetSize ( ) const
inline

Retrieve the width and height of the texture.

Definition at line 94 of file TextureUnmanaged.hpp.

◆ GetWidth()

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

Retrieves the width value for the object.

Returns
The width value of the object.

Definition at line 81 of file TextureUnmanaged.hpp.

◆ IsValid()

bool raylib::TextureUnmanaged::IsValid ( ) const
inline

Determines whether or not the Texture has been loaded and is ready.

Returns
True or false depending on whether the Texture has data.

Definition at line 316 of file TextureUnmanaged.hpp.

Referenced by Load().

◆ Load() [1/3]

void raylib::TextureUnmanaged::Load ( const ::Image &  image)
inline

Load texture from image data.

Definition at line 101 of file TextureUnmanaged.hpp.

References IsValid().

Referenced by TextureUnmanaged().

◆ Load() [2/3]

void raylib::TextureUnmanaged::Load ( const ::Image &  image,
int  layoutType 
)
inline

Load cubemap from image, multiple image cubemap layouts supported.

Definition at line 111 of file TextureUnmanaged.hpp.

References IsValid().

◆ Load() [3/3]

void raylib::TextureUnmanaged::Load ( const std::string_view  fileName)
inline

Load texture from file into GPU memory (VRAM)

Definition at line 121 of file TextureUnmanaged.hpp.

References IsValid().

◆ operator Image()

raylib::TextureUnmanaged::operator Image ( )
inline

Get pixel data from GPU texture and return an Image.

Definition at line 165 of file TextureUnmanaged.hpp.

References GetData().

◆ operator=()

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

Definition at line 86 of file TextureUnmanaged.hpp.

◆ set()

void raylib::TextureUnmanaged::set ( const ::Texture &  texture)
inlineprotected

Definition at line 318 of file TextureUnmanaged.hpp.

◆ SetFilter()

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

Set texture scaling filter mode.

Definition at line 178 of file TextureUnmanaged.hpp.

◆ SetMaterial() [1/2]

TextureUnmanaged & raylib::TextureUnmanaged::SetMaterial ( ::Material *  material,
int  mapType = MATERIAL_MAP_NORMAL 
)
inline

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

Definition at line 285 of file TextureUnmanaged.hpp.

◆ SetMaterial() [2/2]

TextureUnmanaged & raylib::TextureUnmanaged::SetMaterial ( const ::Material &  material,
int  mapType = MATERIAL_MAP_NORMAL 
)
inline

Definition at line 290 of file TextureUnmanaged.hpp.

◆ SetShaderValue()

TextureUnmanaged & raylib::TextureUnmanaged::SetShaderValue ( const ::Shader &  shader,
int  locIndex 
)
inline

Set shader uniform value for texture (sampler2d)

Definition at line 306 of file TextureUnmanaged.hpp.

◆ SetShapes()

TextureUnmanaged & raylib::TextureUnmanaged::SetShapes ( const ::Rectangle &  source)
inline

Set texture and rectangle to be used on shapes drawing.

Definition at line 298 of file TextureUnmanaged.hpp.

◆ SetWrap()

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

Set texture wrapping mode.

Definition at line 186 of file TextureUnmanaged.hpp.

◆ Unload()

void raylib::TextureUnmanaged::Unload ( )
inline

Unload texture from GPU memory (VRAM)

Definition at line 131 of file TextureUnmanaged.hpp.

Referenced by raylib::Texture::~Texture(), and raylib::Texture::operator=().

◆ Update() [1/2]

TextureUnmanaged & raylib::TextureUnmanaged::Update ( ::Rectangle  rec,
const void *  pixels 
)
inline

Update GPU texture rectangle with new data.

Definition at line 150 of file TextureUnmanaged.hpp.

◆ Update() [2/2]

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

Update GPU texture with new data.

Definition at line 142 of file TextureUnmanaged.hpp.