Skip to content

Commit ed54fba

Browse files
authored
Merge pull request #209 from RobLoach/texture-docs
Update Texture documentation, add DrawCube
2 parents fe74513 + 93a758a commit ed54fba

File tree

1 file changed

+101
-15
lines changed

1 file changed

+101
-15
lines changed

include/Texture.hpp

Lines changed: 101 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -215,59 +215,95 @@ class Texture : public ::Texture {
215215

216216
/**
217217
* Draw a Texture2D
218+
*
219+
* @see ::DrawTexture()
218220
*/
219221
inline Texture& Draw(int posX = 0, int posY = 0, ::Color tint = {255, 255, 255, 255}) {
220222
::DrawTexture(*this, posX, posY, tint);
221223
return *this;
222224
}
223225

226+
/**
227+
* Draw a Texture2D with position defined as Vector2
228+
*
229+
* @see ::DrawTextureV()
230+
*/
224231
inline Texture& Draw(::Vector2 position, ::Color tint = {255, 255, 255, 255}) {
225232
::DrawTextureV(*this, position, tint);
226233
return *this;
227234
}
228235

236+
/**
237+
* Draw a Texture2D with extended parameters
238+
*
239+
* @see ::DrawTextureEx()
240+
*/
229241
inline Texture& Draw(::Vector2 position, float rotation, float scale = 1.0f,
230242
::Color tint = {255, 255, 255, 255}) {
231243
::DrawTextureEx(*this, position, rotation, scale, tint);
232244
return *this;
233245
}
234246

247+
/**
248+
* Draw a part of a texture defined by a rectangle
249+
*
250+
* @see ::DrawTextureRec()
251+
*/
235252
inline Texture& Draw(::Rectangle sourceRec, ::Vector2 position = {0, 0},
236253
::Color tint = {255, 255, 255, 255}) {
237254
::DrawTextureRec(*this, sourceRec, position, tint);
238255
return *this;
239256
}
240257

258+
/**
259+
* Draw texture quad with tiling and offset parameters
260+
*
261+
* @see ::DrawTextureQuad()
262+
*/
241263
inline Texture& Draw(::Vector2 tiling, ::Vector2 offset, ::Rectangle quad,
242264
::Color tint = {255, 255, 255, 255}) {
243265
::DrawTextureQuad(*this, tiling, offset, quad, tint);
244266
return *this;
245267
}
246268

247-
inline Texture& Draw(::Vector3 position, float width, float height, float length,
248-
::Color tint = {255, 255, 255, 255}) {
249-
::DrawCubeTexture(*this, position, width, height, length, tint);
250-
return *this;
251-
}
252-
253-
inline Texture& DrawTiled(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
254-
float rotation = 0, float scale = 1, Color tint = {255, 255, 255, 255}) {
255-
::DrawTextureTiled(*this, sourceRec, destRec, origin, rotation, scale, tint);
256-
return *this;
257-
}
258-
269+
/**
270+
* Draw a part of a texture defined by a rectangle with 'pro' parameters
271+
*
272+
* @see ::DrawTexturePro()
273+
*/
259274
inline Texture& Draw(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
260275
float rotation = 0, ::Color tint = {255, 255, 255, 255}) {
261276
::DrawTexturePro(*this, sourceRec, destRec, origin, rotation, tint);
262277
return *this;
263278
}
264279

280+
/**
281+
* Draws a texture (or part of it) that stretches or shrinks nicely
282+
*
283+
* @see ::DrawTextureNPatch()
284+
*/
265285
inline Texture& Draw(::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin = {0, 0},
266286
float rotation = 0, ::Color tint = {255, 255, 255, 255}) {
267287
::DrawTextureNPatch(*this, nPatchInfo, destRec, origin, rotation, tint);
268288
return *this;
269289
}
270290

291+
/**
292+
* Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
293+
*
294+
* @see ::DrawTextureTiled()
295+
*/
296+
inline Texture& DrawTiled(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
297+
float rotation = 0, float scale = 1, Color tint = {255, 255, 255, 255}) {
298+
::DrawTextureTiled(*this, sourceRec, destRec, origin, rotation, scale, tint);
299+
return *this;
300+
}
301+
302+
/**
303+
* Draw a textured polygon
304+
*
305+
* @see ::DrawTexturePoly()
306+
*/
271307
inline Texture& DrawPoly(::Vector2 center, ::Vector2 *points,
272308
::Vector2 *texcoords, int pointsCount,
273309
::Color tint = {255, 255, 255, 255}) {
@@ -277,6 +313,8 @@ class Texture : public ::Texture {
277313

278314
/**
279315
* Draw a billboard texture
316+
*
317+
* @see ::DrawBillboard()
280318
*/
281319
inline Texture& DrawBillboard(const ::Camera& camera,
282320
::Vector3 position, float size,
@@ -287,8 +325,10 @@ class Texture : public ::Texture {
287325

288326
/**
289327
* Draw a billboard texture defined by source
328+
*
329+
* @see ::DrawBillboardRec()
290330
*/
291-
inline Texture& DrawBillboard(const ::Camera& camera,
331+
inline Texture& DrawBillboard(const ::Camera& camera,
292332
::Rectangle source, ::Vector3 position, ::Vector2 size,
293333
::Color tint = {255, 255, 255, 255}) {
294334
DrawBillboardRec(camera, *this, source, position, size, tint);
@@ -297,15 +337,61 @@ class Texture : public ::Texture {
297337

298338
/**
299339
* Draw a billboard texture defined by source and rotation
340+
*
341+
* @see ::DrawBillboardPro()
300342
*/
301-
inline Texture& DrawBillboard(const ::Camera& camera,
343+
inline Texture& DrawBillboard(const ::Camera& camera,
302344
::Rectangle source, Vector3 position,
303-
::Vector3 up, Vector2 size, Vector2 origin, float rotation,
345+
::Vector3 up, Vector2 size, Vector2 origin, float rotation = 0.0f,
304346
::Color tint = {255, 255, 255, 255}) {
305347
DrawBillboardPro(camera, *this, source, position, up, size, origin, rotation, tint);
306348
return *this;
307349
}
308350

351+
/**
352+
* Draw cube textured
353+
*
354+
* @see ::DrawCubeTexture()
355+
*/
356+
inline Texture& DrawCube(::Vector3 position, float width, float height, float length,
357+
::Color color = {255, 255, 255, 255}) {
358+
::DrawCubeTexture(*this, position, width, height, length, color);
359+
return *this;
360+
}
361+
362+
/**
363+
* Draw cube textured, with dimensions
364+
*
365+
* @see ::DrawCubeTexture()
366+
*/
367+
inline Texture& DrawCube(::Vector3 position, ::Vector3 dimensions,
368+
::Color color = {255, 255, 255, 255}) {
369+
::DrawCubeTexture(*this, position, dimensions.x, dimensions.y, dimensions.z, color);
370+
return *this;
371+
}
372+
373+
/**
374+
* Draw cube with a region of a texture
375+
*
376+
* @see ::DrawCubeTextureRec()
377+
*/
378+
inline Texture& DrawCube(::Rectangle source, ::Vector3 position, float width, float height, float length,
379+
::Color color = {255, 255, 255, 255}) {
380+
::DrawCubeTextureRec(*this, source, position, width, height, length, color);
381+
return *this;
382+
}
383+
384+
/**
385+
* Draw cube with a region of a texture, with dimensions
386+
*
387+
* @see ::DrawCubeTextureRec()
388+
*/
389+
inline Texture& DrawCube(::Rectangle source, ::Vector3 position, ::Vector3 dimensions,
390+
::Color color = {255, 255, 255, 255}) {
391+
::DrawCubeTextureRec(*this, source, position, dimensions.x, dimensions.y, dimensions.z, color);
392+
return *this;
393+
}
394+
309395
/**
310396
* Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
311397
*/

0 commit comments

Comments
 (0)