 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
25 #ifndef RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
26 #define RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
30 #include "./raylib.hpp"
31 #include "./raylib-cpp-utils.hpp"
32 #include "./Vector2.hpp"
33 #include "./Material.hpp"
39 set(::GetTextureDefault());
57 GETTERSETTER(
unsigned int, Id,
id)
58 GETTERSETTER(
int, Width, width)
59 GETTERSETTER(
int, Height, height)
60 GETTERSETTER(
int, Mipmaps, mipmaps)
61 GETTERSETTER(
int, Format, format)
77 set(::LoadTextureFromImage(image));
90 void Load(
const std::string& fileName) {
91 set(::LoadTexture(fileName.c_str()));
98 ::UnloadTexture(*
this);
105 ::UpdateTexture(*
this, pixels);
113 UpdateTextureRec(*
this, rec, pixels);
121 return ::GetTextureData(*
this);
135 ::GenTextureMipmaps(
this);
143 ::SetTextureFilter(*
this, filterMode);
151 ::SetTextureWrap(*
this, wrapMode);
159 ::DrawTexture(*
this, 0, 0, WHITE);
164 ::DrawTexture(*
this, posX, posY, tint);
169 ::DrawTextureV(*
this, position, tint);
174 ::
Color tint = WHITE) {
175 ::DrawTextureEx(*
this, position, rotation, scale, tint);
180 ::DrawTextureRec(*
this, sourceRec, position, tint);
185 ::
Color tint = WHITE) {
186 ::DrawTextureQuad(*
this, tiling, offset, quad, tint);
191 float rotation = 0, ::
Color tint = WHITE) {
192 ::DrawTexturePro(*
this, sourceRec, destRec, origin, rotation, tint);
197 float rotation = 0, ::
Color tint = WHITE) {
198 ::DrawTextureNPatch(*
this, nPatchInfo, destRec, origin, rotation, tint);
203 ::
Color color = WHITE) {
204 ::DrawCubeTexture(*
this, position, width, height, length, color);
209 float rotation,
float scale,
Color tint = WHITE) {
210 ::DrawTextureTiled(*
this, sourceRec, destRec, origin, rotation, scale, tint);
218 ::SetMaterialTexture(material, mapType, *
this);
226 return ::GetPixelDataSize(width, height, format);
240 width = texture.width;
241 height = texture.height;
242 mipmaps = texture.mipmaps;
243 format = texture.format;
252 #endif // RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
static int GetPixelDataSize(int width, int height, int format)
Get pixel data size in bytes for certain format.
Provides all the classes associated with raylib-cpp.
Texture & SetWrap(int wrapMode)
Set texture wrapping mode.
Texture & operator=(const Texture &texture)
void LoadTextureCubemap(const ::Image &image, int layoutType)
Load cubemap from image, multiple image cubemap layouts supported.
Texture & Draw(::Vector2 tiling, ::Vector2 offset, ::Rectangle quad, ::Color tint=WHITE)
Texture & Draw(::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin, float rotation=0, ::Color tint=WHITE)
void set(::Texture texture)
Texture(const ::Image &image)
Texture & SetShapesTexture(Rectangle source)
Define default texture used to draw shapes.
Texture & Draw(::Vector3 position, float width, float height, float length, ::Color color=WHITE)
void Load(const std::string &fileName)
Load texture from file into GPU memory (VRAM)
void LoadFromImage(const ::Image &image)
Load texture from image data.
Texture(const std::string &fileName)
Load texture from file into GPU memory (VRAM)
Texture & SetFilter(int filterMode)
Set texture scaling filter mode.
Texture & Draw(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin, float rotation=0, ::Color tint=WHITE)
Texture & DrawTiled(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin, float rotation, float scale, Color tint=WHITE)
Texture & Draw(::Vector2 position, ::Color tint=WHITE)
Texture & Draw()
Draws the texture at the top left corner of the screen.
Texture & UpdateRec(::Rectangle rec, const void *pixels)
Update GPU texture rectangle with new data.
Texture & Draw(::Vector2 position, float rotation, float scale=1.0f, ::Color tint=WHITE)
void Unload()
Unload texture from GPU memory (VRAM)
Texture & GenMipmaps()
Generate GPU mipmaps for a texture.
Texture & SetMaterial(::Material *material, int mapType)
Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
Texture & Update(const void *pixels)
Update GPU texture with new data.
Texture & Draw(::Rectangle sourceRec, ::Vector2 position, ::Color tint=WHITE)
Image GetTextureData() const
Get pixel data from GPU texture and return an Image.
Texture & Draw(int posX, int posY, ::Color tint=WHITE)