1 #ifndef RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
2 #define RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
8 #include "./Vector2.hpp"
9 #include "./Material.hpp"
17 Texture(const ::Texture& texture) {
22 set(::GetTextureDefault());
40 GETTERSETTER(
unsigned int, Id,
id)
41 GETTERSETTER(
int, Width, width)
42 GETTERSETTER(
int, Height, height)
43 GETTERSETTER(
int, Mipmaps, mipmaps)
44 GETTERSETTER(
int, Format, format)
55 return {
static_cast<float>(width),
static_cast<float>(height)};
62 set(::LoadTextureFromImage(image));
75 void Load(
const std::string& fileName) {
76 set(::LoadTexture(fileName.c_str()));
83 ::UnloadTexture(*
this);
90 ::UpdateTexture(*
this, pixels);
98 UpdateTextureRec(*
this, rec, pixels);
106 return ::GetTextureData(*
this);
120 ::GenTextureMipmaps(
this);
128 ::SetTextureFilter(*
this, filterMode);
136 ::SetTextureWrap(*
this, wrapMode);
151 ::DrawTexture(*
this, posX, posY, tint);
155 inline Texture&
Draw(::Vector2 position, ::Color tint = {255, 255, 255, 255}) {
156 ::DrawTextureV(*
this, position, tint);
160 inline Texture&
Draw(::Vector2 position,
float rotation,
float scale = 1.0f,
161 ::Color tint = {255, 255, 255, 255}) {
162 ::DrawTextureEx(*
this, position, rotation, scale, tint);
166 inline Texture&
Draw(::Rectangle sourceRec, ::Vector2 position = {0, 0},
167 ::Color tint = {255, 255, 255, 255}) {
168 ::DrawTextureRec(*
this, sourceRec, position, tint);
172 inline Texture&
Draw(::Vector2 tiling, ::Vector2 offset, ::Rectangle quad,
173 ::Color tint = {255, 255, 255, 255}) {
174 ::DrawTextureQuad(*
this, tiling, offset, quad, tint);
178 inline Texture&
Draw(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
179 float rotation = 0, ::Color tint = {255, 255, 255, 255}) {
180 ::DrawTexturePro(*
this, sourceRec, destRec, origin, rotation, tint);
184 inline Texture&
Draw(::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin = {0, 0},
185 float rotation = 0, ::Color tint = {255, 255, 255, 255}) {
186 ::DrawTextureNPatch(*
this, nPatchInfo, destRec, origin, rotation, tint);
190 inline Texture&
Draw(::Vector3 position,
float width,
float height,
float length,
191 ::Color color = {255, 255, 255, 255}) {
192 ::DrawCubeTexture(*
this, position, width, height, length, color);
196 inline Texture& DrawTiled(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
197 float rotation = 0,
float scale = 1, Color tint = {255, 255, 255, 255}) {
198 ::DrawTextureTiled(*
this, sourceRec, destRec, origin, rotation, scale, tint);
206 ::SetMaterialTexture(material, mapType, *
this);
214 return ::GetPixelDataSize(width, height, format);
221 ::SetShapesTexture(*
this, source);
226 inline void set(const ::Texture& texture) {
228 width = texture.width;
229 height = texture.height;
230 mipmaps = texture.mipmaps;
231 format = texture.format;
236 typedef Texture Texture2D;
237 typedef Texture TextureCubemap;
241 #endif // RAYLIB_CPP_INCLUDE_TEXTURE_HPP_