Make Draw() functions not return the object

Fixes #192
This commit is contained in:
Rob Loach
2022-09-28 14:52:47 -04:00
parent 67f6758769
commit 1ab778f236
16 changed files with 135 additions and 229 deletions

View File

@@ -33,9 +33,9 @@ int main(void) {
// Draw one image over the other with a scaling of 1.5f
parrots
.Draw(cat,
raylib::Rectangle(0, 0, cat.GetWidth(), cat.GetHeight()),
raylib::Rectangle(30, 40, cat.GetWidth() * 1.5f, cat.GetHeight() * 1.5f))
.Crop(raylib::Rectangle(0, 50, parrots.GetWidth(), parrots.GetHeight() - 100)); // Crop resulting image
raylib::Rectangle(0, 0, cat.GetWidth(), cat.GetHeight()),
raylib::Rectangle(30, 40, cat.GetWidth() * 1.5f, cat.GetHeight() * 1.5f));
parrots.Crop(raylib::Rectangle(0, 50, parrots.GetWidth(), parrots.GetHeight() - 100)); // Crop resulting image
// Load custom font for frawing on image
raylib::Font font("resources/custom_jupiter_crash.png");

View File

@@ -38,9 +38,8 @@ class BoundingBox : public ::BoundingBox {
/**
* Draw a bounding box with wires
*/
inline BoundingBox& Draw(::Color color = {255, 255, 255, 255}) {
inline void Draw(::Color color = {255, 255, 255, 255}) const {
::DrawBoundingBox(*this, color);
return *this;
}
/**

View File

@@ -126,26 +126,24 @@ class Camera3D : public ::Camera3D {
/**
* Draw a billboard texture.
*/
inline Camera3D& DrawBillboard(
inline void DrawBillboard(
const ::Texture2D& texture,
::Vector3 center,
float size,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawBillboard(*this, texture, center, size, tint);
return *this;
}
/**
* Draw a billboard texture defined by source.
*/
inline Camera3D& DrawBillboard(
inline void DrawBillboard(
const ::Texture2D& texture,
::Rectangle sourceRec,
::Vector3 center,
::Vector2 size,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawBillboardRec(*this, texture, sourceRec, center, size, tint);
return *this;
}
private:

View File

@@ -111,98 +111,82 @@ class Color : public ::Color {
return *this;
}
inline Color& DrawPixel(int x, int y) {
inline void DrawPixel(int x, int y) const {
::DrawPixel(x, y, *this);
return *this;
}
/**
* Draw a pixel
*/
inline Color& DrawPixel(::Vector2 pos) {
inline void DrawPixel(::Vector2 pos) const {
::DrawPixelV(pos, *this);
return *this;
}
/**
* Draw a line
*/
inline Color& DrawLine(int startPosX, int startPosY, int endPosX, int endPosY) {
inline void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY) const {
::DrawLine(startPosX, startPosY, endPosX, endPosY, *this);
return *this;
}
inline Color& DrawLine(::Vector2 startPos, ::Vector2 endPos) {
inline void DrawLine(::Vector2 startPos, ::Vector2 endPos) const {
::DrawLineV(startPos, endPos, *this);
return *this;
}
inline Color& DrawLine(::Vector2 startPos, ::Vector2 endPos, float thick) {
inline void DrawLine(::Vector2 startPos, ::Vector2 endPos, float thick) const {
::DrawLineEx(startPos, endPos, thick, *this);
return *this;
}
inline Color& DrawLineBezier(::Vector2 startPos, ::Vector2 endPos, float thick) {
inline void DrawLineBezier(::Vector2 startPos, ::Vector2 endPos, float thick) const {
::DrawLineBezier(startPos, endPos, thick, *this);
return *this;
}
inline Color& DrawLineStrip(::Vector2 *points, int numPoints) {
inline void DrawLineStrip(::Vector2 *points, int numPoints) const {
::DrawLineStrip(points, numPoints, *this);
return *this;
}
inline Color& DrawText(const std::string& text, int posX, int posY, int fontSize) {
inline void DrawText(const std::string& text, int posX, int posY, int fontSize) const {
::DrawText(text.c_str(), posX, posY, fontSize, *this);
return *this;
}
inline Color& DrawText(const ::Font& font, const std::string& text, ::Vector2 position,
float fontSize, float spacing) {
inline void DrawText(const ::Font& font, const std::string& text, ::Vector2 position,
float fontSize, float spacing) const {
::DrawTextEx(font, text.c_str(), position, fontSize, spacing, *this);
return *this;
}
inline Color& DrawText(
inline void DrawText(
const ::Font& font,
const std::string& text,
::Vector2 position,
::Vector2 origin,
float rotation,
float fontSize,
float spacing) {
float spacing) const {
::DrawTextPro(font, text.c_str(), position, origin, rotation, fontSize, spacing, *this);
return *this;
}
inline Color& DrawRectangle(int posX, int posY, int width, int height) {
inline void DrawRectangle(int posX, int posY, int width, int height) const {
::DrawRectangle(posX, posY, width, height, *this);
return *this;
}
inline Color& DrawRectangle(::Vector2 position, ::Vector2 size) {
inline void DrawRectangle(::Vector2 position, ::Vector2 size) const {
::DrawRectangleV(position, size, *this);
return *this;
}
inline Color& DrawRectangle(::Rectangle rec) {
inline void DrawRectangle(::Rectangle rec) const {
::DrawRectangleRec(rec, *this);
return *this;
}
inline Color& DrawRectangle(::Rectangle rec, ::Vector2 origin, float rotation) {
inline void DrawRectangle(::Rectangle rec, ::Vector2 origin, float rotation) const {
::DrawRectanglePro(rec, origin, rotation, *this);
return *this;
}
inline Color& DrawRectangleLines(int posX, int posY, int width, int height) {
inline void DrawRectangleLines(int posX, int posY, int width, int height) const {
::DrawRectangleLines(posX, posY, width, height, *this);
return *this;
}
inline Color& DrawRectangleLines(::Rectangle rec, float lineThick) {
inline void DrawRectangleLines(::Rectangle rec, float lineThick) const {
::DrawRectangleLinesEx(rec, lineThick, *this);
return *this;
}
/**

View File

@@ -209,61 +209,56 @@ class Font : public ::Font {
/**
* Draw text using font and additional parameters.
*/
inline Font& DrawText(const std::string& text, ::Vector2 position, float fontSize,
float spacing, ::Color tint = WHITE) {
inline void DrawText(const std::string& text, ::Vector2 position, float fontSize,
float spacing, ::Color tint = WHITE) const {
::DrawTextEx(*this, text.c_str(), position, fontSize, spacing, tint);
return *this;
}
/**
* Draw text using font and additional parameters.
*/
inline Font& DrawText(const std::string& text, int posX, int posY, float fontSize,
float spacing, ::Color tint = WHITE) {
inline void DrawText(const std::string& text, int posX, int posY, float fontSize,
float spacing, ::Color tint = WHITE) const {
::DrawTextEx(*this, text.c_str(),
{ static_cast<float>(posX), static_cast<float>(posY) },
fontSize, spacing, tint);
return *this;
}
inline Font& DrawText(
inline void DrawText(
const std::string& text,
::Vector2 position,
::Vector2 origin,
float rotation,
float fontSize,
float spacing,
::Color tint = WHITE) {
::Color tint = WHITE) const {
::DrawTextPro(*this, text.c_str(),
position, origin,
rotation, fontSize,
spacing, tint);
return *this;
}
/**
* Draw one character (codepoint)
*/
inline Font& DrawText(int codepoint,
inline void DrawText(int codepoint,
::Vector2 position,
float fontSize,
::Color tint = { 255, 255, 255, 255 }) {
::Color tint = { 255, 255, 255, 255 }) const {
::DrawTextCodepoint(*this, codepoint, position, fontSize, tint);
return *this;
}
/**
* Draw multiple character (codepoint)
*/
inline Font& DrawText(const int *codepoints,
inline void DrawText(const int *codepoints,
int count, ::Vector2 position,
float fontSize, float spacing,
::Color tint = { 255, 255, 255, 255 }) {
::Color tint = { 255, 255, 255, 255 }) const {
::DrawTextCodepoints(*this,
codepoints, count,
position, fontSize,
spacing, tint);
return *this;
}
/**

View File

@@ -586,69 +586,58 @@ class Image : public ::Image {
/**
* Draw pixel within an image
*/
inline Image& DrawPixel(int posX, int posY, ::Color color = {255, 255, 255, 255}) {
inline void DrawPixel(int posX, int posY, ::Color color = {255, 255, 255, 255}) {
::ImageDrawPixel(this, posX, posY, color);
return *this;
}
inline Image& DrawPixel(::Vector2 position, ::Color color = {255, 255, 255, 255}) {
inline void DrawPixel(::Vector2 position, ::Color color = {255, 255, 255, 255}) {
::ImageDrawPixelV(this, position, color);
return *this;
}
inline Image& DrawLine(int startPosX, int startPosY, int endPosX, int endPosY,
inline void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY,
::Color color = {255, 255, 255, 255}) {
::ImageDrawLine(this, startPosX, startPosY, endPosX, endPosY, color);
return *this;
}
inline Image& DrawLine(::Vector2 start, ::Vector2 end, ::Color color = {255, 255, 255, 255}) {
inline void DrawLine(::Vector2 start, ::Vector2 end, ::Color color = {255, 255, 255, 255}) {
::ImageDrawLineV(this, start, end, color);
return *this;
}
inline Image& DrawCircle(int centerX, int centerY, int radius,
inline void DrawCircle(int centerX, int centerY, int radius,
::Color color = {255, 255, 255, 255}) {
::ImageDrawCircle(this, centerX, centerY, radius, color);
return *this;
}
inline Image& DrawCircle(::Vector2 center, int radius,
inline void DrawCircle(::Vector2 center, int radius,
::Color color = {255, 255, 255, 255}) {
::ImageDrawCircleV(this, center, radius, color);
return *this;
}
inline Image& DrawRectangle(int posX, int posY, int width, int height,
inline void DrawRectangle(int posX, int posY, int width, int height,
::Color color = {255, 255, 255, 255}) {
::ImageDrawRectangle(this, posX, posY, width, height, color);
return *this;
}
inline Image& DrawRectangle(Vector2 position, Vector2 size,
inline void DrawRectangle(Vector2 position, Vector2 size,
::Color color = {255, 255, 255, 255}) {
::ImageDrawRectangleV(this, position, size, color);
return *this;
}
inline Image& DrawRectangle(::Rectangle rec, ::Color color = {255, 255, 255, 255}) {
inline void DrawRectangle(::Rectangle rec, ::Color color = {255, 255, 255, 255}) {
::ImageDrawRectangleRec(this, rec, color);
return *this;
}
inline Image& DrawRectangleLines(::Rectangle rec, int thick = 1,
inline void DrawRectangleLines(::Rectangle rec, int thick = 1,
::Color color = {255, 255, 255, 255}) {
::ImageDrawRectangleLines(this, rec, thick, color);
return *this;
}
inline Image& Draw(const ::Image& src, ::Rectangle srcRec, ::Rectangle dstRec,
inline void Draw(const ::Image& src, ::Rectangle srcRec, ::Rectangle dstRec,
::Color tint = {255, 255, 255, 255}) {
::ImageDraw(this, src, srcRec, dstRec, tint);
return *this;
}
inline Image& DrawText(const std::string& text, ::Vector2 position, int fontSize,
inline void DrawText(const std::string& text, ::Vector2 position, int fontSize,
::Color color = {255, 255, 255, 255}) {
::ImageDrawText(this,
text.c_str(),
@@ -656,19 +645,16 @@ class Image : public ::Image {
static_cast<int>(position.y),
fontSize,
color);
return *this;
}
inline Image& DrawText(const std::string& text, int x, int y, int fontSize,
inline void DrawText(const std::string& text, int x, int y, int fontSize,
::Color color = {255, 255, 255, 255}) {
::ImageDrawText(this, text.c_str(), x, y, fontSize, color);
return *this;
}
inline Image& DrawText(const ::Font& font, const std::string& text, ::Vector2 position,
inline void DrawText(const ::Font& font, const std::string& text, ::Vector2 position,
float fontSize, float spacing, ::Color tint = {255, 255, 255, 255}) {
::ImageDrawTextEx(this, font, text.c_str(), position, fontSize, spacing, tint);
return *this;
}
/**

View File

@@ -98,17 +98,15 @@ class Material : public ::Material {
/**
* Draw a 3d mesh with material and transform
*/
inline const Material& DrawMesh(const ::Mesh& mesh, ::Matrix transform) const {
inline void DrawMesh(const ::Mesh& mesh, ::Matrix transform) const {
::DrawMesh(mesh, *this, transform);
return *this;
}
/**
* Draw multiple mesh instances with material and different transforms
*/
inline const Material& DrawMesh(const ::Mesh& mesh, ::Matrix* transforms, int instances) const {
inline void DrawMesh(const ::Mesh& mesh, ::Matrix* transforms, int instances) const {
::DrawMeshInstanced(mesh, *this, transforms, instances);
return *this;
}
private:

View File

@@ -198,14 +198,14 @@ class Mesh : public ::Mesh {
/**
* Draw a 3d mesh with material and transform
*/
inline void Draw(const ::Material& material, const ::Matrix& transform) {
inline void Draw(const ::Material& material, const ::Matrix& transform) const {
::DrawMesh(*this, material, transform);
}
/**
* Draw multiple mesh instances with material and different transforms
*/
inline void Draw(const ::Material& material, ::Matrix* transforms, int instances) {
inline void Draw(const ::Material& material, ::Matrix* transforms, int instances) const {
::DrawMeshInstanced(*this, material, transforms, instances);
}

View File

@@ -144,47 +144,43 @@ class Model : public ::Model {
/**
* Draw a model (with texture if set)
*/
inline Model& Draw(::Vector3 position,
inline void Draw(::Vector3 position,
float scale = 1.0f,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawModel(*this, position, scale, tint);
return *this;
}
/**
* Draw a model with extended parameters
*/
inline Model& Draw(
inline void Draw(
::Vector3 position,
::Vector3 rotationAxis,
float rotationAngle = 0.0f,
::Vector3 scale = {1.0f, 1.0f, 1.0f},
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawModelEx(*this, position, rotationAxis, rotationAngle, scale, tint);
return *this;
}
/**
* Draw a model wires (with texture if set)
*/
inline Model& DrawWires(::Vector3 position,
inline void DrawWires(::Vector3 position,
float scale = 1.0f,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawModelWires(*this, position, scale, tint);
return *this;
}
/**
* Draw a model wires (with texture if set) with extended parameters
*/
inline Model& DrawWires(
inline void DrawWires(
::Vector3 position,
::Vector3 rotationAxis,
float rotationAngle = 0.0f,
::Vector3 scale = {1.0f, 1.0f, 1.0f},
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawModelWiresEx(*this, position, rotationAxis, rotationAngle, scale, tint);
return *this;
}
/**

View File

@@ -35,9 +35,8 @@ class Ray : public ::Ray {
/**
* Draw a ray line
*/
inline Ray& Draw(::Color color) {
inline void Draw(::Color color) const {
DrawRay(*this, color);
return *this;
}
/**

View File

@@ -45,54 +45,44 @@ class Rectangle : public ::Rectangle {
/**
* Draw a color-filled rectangle
*/
inline Rectangle& Draw(::Color color) {
::DrawRectangle(static_cast<int>(x), static_cast<int>(y), static_cast<int>(width),
static_cast<int>(height), color);
return *this;
inline void Draw(::Color color) const {
::DrawRectangleRec(*this, color);
}
inline Rectangle& Draw(::Vector2 origin, float rotation, ::Color color) {
inline void Draw(::Vector2 origin, float rotation, ::Color color) const {
::DrawRectanglePro(*this, origin, rotation, color);
return *this;
}
inline Rectangle& DrawGradientV(::Color color1, ::Color color2) {
inline void DrawGradientV(::Color color1, ::Color color2) const {
::DrawRectangleGradientV(static_cast<int>(x), static_cast<int>(y), static_cast<int>(width),
static_cast<int>(height), color1, color2);
return *this;
}
inline Rectangle& DrawGradientH(::Color color1, ::Color color2) {
inline void DrawGradientH(::Color color1, ::Color color2) const {
::DrawRectangleGradientH(static_cast<int>(x), static_cast<int>(y), static_cast<int>(width),
static_cast<int>(height), color1, color2);
return *this;
}
inline Rectangle& DrawGradient(::Color col1, ::Color col2, ::Color col3, ::Color col4) {
inline void DrawGradient(::Color col1, ::Color col2, ::Color col3, ::Color col4) const {
::DrawRectangleGradientEx(*this, col1, col2, col3, col4);
return *this;
}
inline Rectangle& DrawLines(::Color color) {
inline void DrawLines(::Color color) const {
::DrawRectangleLines(static_cast<int>(x), static_cast<int>(y), static_cast<int>(width),
static_cast<int>(height), color);
return *this;
}
inline Rectangle& DrawLines(::Color color, float lineThick) {
inline void DrawLines(::Color color, float lineThick) const {
::DrawRectangleLinesEx(*this, lineThick, color);
return *this;
}
inline Rectangle& DrawRounded(float roundness, int segments, ::Color color) {
inline void DrawRounded(float roundness, int segments, ::Color color) const {
::DrawRectangleRounded(*this, roundness, segments, color);
return *this;
}
inline Rectangle& DrawRoundedLines(float roundness, int segments,
float lineThick, ::Color color) {
inline void DrawRoundedLines(float roundness, int segments,
float lineThick, ::Color color) const {
::DrawRectangleRoundedLines(*this, roundness, segments, lineThick, color);
return *this;
}
/**

View File

@@ -93,14 +93,14 @@ class Text {
/**
* Draw text with values in class.
*/
inline void Draw(const ::Vector2& position) {
inline void Draw(const ::Vector2& position) const {
::DrawTextEx(font, text.c_str(), position, fontSize, spacing, color);
}
/**
* Draw text with values in class.
*/
inline void Draw(int posX, int posY) {
inline void Draw(int posX, int posY) const {
::DrawTextEx(font,
text.c_str(),
{ static_cast<float>(posX), static_cast<float>(posY) },
@@ -114,7 +114,7 @@ class Text {
*
* @see DrawTextPro()
*/
inline void Draw(const ::Vector2& position, float rotation, const Vector2& origin = {0, 0}) {
inline void Draw(const ::Vector2& position, float rotation, const ::Vector2& origin = {0, 0}) const {
::DrawTextPro(font, text.c_str(), position, origin, rotation, fontSize, spacing, color);
}

View File

@@ -194,9 +194,8 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTexture()
*/
inline TextureUnmanaged& Draw(int posX = 0, int posY = 0, ::Color tint = {255, 255, 255, 255}) {
inline void Draw(int posX = 0, int posY = 0, ::Color tint = {255, 255, 255, 255}) const {
::DrawTexture(*this, posX, posY, tint);
return *this;
}
/**
@@ -204,9 +203,8 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTextureV()
*/
inline TextureUnmanaged& Draw(::Vector2 position, ::Color tint = {255, 255, 255, 255}) {
inline void Draw(::Vector2 position, ::Color tint = {255, 255, 255, 255}) const {
::DrawTextureV(*this, position, tint);
return *this;
}
/**
@@ -214,10 +212,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTextureEx()
*/
inline TextureUnmanaged& Draw(::Vector2 position, float rotation, float scale = 1.0f,
::Color tint = {255, 255, 255, 255}) {
inline void Draw(::Vector2 position, float rotation, float scale = 1.0f,
::Color tint = {255, 255, 255, 255}) const {
::DrawTextureEx(*this, position, rotation, scale, tint);
return *this;
}
/**
@@ -225,10 +222,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTextureRec()
*/
inline TextureUnmanaged& Draw(::Rectangle sourceRec, ::Vector2 position = {0, 0},
::Color tint = {255, 255, 255, 255}) {
inline void Draw(::Rectangle sourceRec, ::Vector2 position = {0, 0},
::Color tint = {255, 255, 255, 255}) const {
::DrawTextureRec(*this, sourceRec, position, tint);
return *this;
}
/**
@@ -236,10 +232,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTextureQuad()
*/
inline TextureUnmanaged& Draw(::Vector2 tiling, ::Vector2 offset, ::Rectangle quad,
::Color tint = {255, 255, 255, 255}) {
inline void Draw(::Vector2 tiling, ::Vector2 offset, ::Rectangle quad,
::Color tint = {255, 255, 255, 255}) const {
::DrawTextureQuad(*this, tiling, offset, quad, tint);
return *this;
}
/**
@@ -247,10 +242,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTexturePro()
*/
inline TextureUnmanaged& Draw(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
float rotation = 0, ::Color tint = {255, 255, 255, 255}) {
inline void Draw(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
float rotation = 0, ::Color tint = {255, 255, 255, 255}) const {
::DrawTexturePro(*this, sourceRec, destRec, origin, rotation, tint);
return *this;
}
/**
@@ -258,10 +252,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTextureNPatch()
*/
inline TextureUnmanaged& Draw(::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin = {0, 0},
float rotation = 0, ::Color tint = {255, 255, 255, 255}) {
inline void Draw(::NPatchInfo nPatchInfo, ::Rectangle destRec, ::Vector2 origin = {0, 0},
float rotation = 0, ::Color tint = {255, 255, 255, 255}) const {
::DrawTextureNPatch(*this, nPatchInfo, destRec, origin, rotation, tint);
return *this;
}
/**
@@ -269,10 +262,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTextureTiled()
*/
inline TextureUnmanaged& DrawTiled(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
float rotation = 0, float scale = 1, Color tint = {255, 255, 255, 255}) {
inline void DrawTiled(::Rectangle sourceRec, ::Rectangle destRec, ::Vector2 origin = {0, 0},
float rotation = 0, float scale = 1, Color tint = {255, 255, 255, 255}) const {
::DrawTextureTiled(*this, sourceRec, destRec, origin, rotation, scale, tint);
return *this;
}
/**
@@ -280,11 +272,10 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawTexturePoly()
*/
inline TextureUnmanaged& DrawPoly(::Vector2 center, ::Vector2 *points,
inline void DrawPoly(::Vector2 center, ::Vector2 *points,
::Vector2 *texcoords, int pointsCount,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawTexturePoly(*this, center, points, texcoords, pointsCount, tint);
return *this;
}
/**
@@ -292,11 +283,10 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawBillboard()
*/
inline TextureUnmanaged& DrawBillboard(const ::Camera& camera,
inline void DrawBillboard(const ::Camera& camera,
::Vector3 position, float size,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
::DrawBillboard(camera, *this, position, size, tint);
return *this;
}
/**
@@ -304,11 +294,10 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawBillboardRec()
*/
inline TextureUnmanaged& DrawBillboard(const ::Camera& camera,
inline void DrawBillboard(const ::Camera& camera,
::Rectangle source, ::Vector3 position, ::Vector2 size,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
DrawBillboardRec(camera, *this, source, position, size, tint);
return *this;
}
/**
@@ -316,12 +305,11 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawBillboardPro()
*/
inline TextureUnmanaged& DrawBillboard(const ::Camera& camera,
inline void DrawBillboard(const ::Camera& camera,
::Rectangle source, Vector3 position,
::Vector3 up, Vector2 size, Vector2 origin, float rotation = 0.0f,
::Color tint = {255, 255, 255, 255}) {
::Color tint = {255, 255, 255, 255}) const {
DrawBillboardPro(camera, *this, source, position, up, size, origin, rotation, tint);
return *this;
}
/**
@@ -329,10 +317,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawCubeTexture()
*/
inline TextureUnmanaged& DrawCube(::Vector3 position, float width, float height, float length,
::Color color = {255, 255, 255, 255}) {
inline void DrawCube(::Vector3 position, float width, float height, float length,
::Color color = {255, 255, 255, 255}) const {
::DrawCubeTexture(*this, position, width, height, length, color);
return *this;
}
/**
@@ -340,10 +327,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawCubeTexture()
*/
inline TextureUnmanaged& DrawCube(::Vector3 position, ::Vector3 dimensions,
::Color color = {255, 255, 255, 255}) {
inline void DrawCube(::Vector3 position, ::Vector3 dimensions,
::Color color = {255, 255, 255, 255}) const {
::DrawCubeTexture(*this, position, dimensions.x, dimensions.y, dimensions.z, color);
return *this;
}
/**
@@ -351,10 +337,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawCubeTextureRec()
*/
inline TextureUnmanaged& DrawCube(::Rectangle source, ::Vector3 position, float width, float height, float length,
::Color color = {255, 255, 255, 255}) {
inline void DrawCube(::Rectangle source, ::Vector3 position, float width, float height, float length,
::Color color = {255, 255, 255, 255}) const {
::DrawCubeTextureRec(*this, source, position, width, height, length, color);
return *this;
}
/**
@@ -362,10 +347,9 @@ class TextureUnmanaged : public ::Texture {
*
* @see ::DrawCubeTextureRec()
*/
inline TextureUnmanaged& DrawCube(::Rectangle source, ::Vector3 position, ::Vector3 dimensions,
::Color color = {255, 255, 255, 255}) {
inline void DrawCube(::Rectangle source, ::Vector3 position, ::Vector3 dimensions,
::Color color = {255, 255, 255, 255}) const {
::DrawCubeTextureRec(*this, source, position, dimensions.x, dimensions.y, dimensions.z, color);
return *this;
}
/**

View File

@@ -286,54 +286,46 @@ class Vector2 : public ::Vector2 {
}
#endif
inline Vector2& DrawPixel(::Color color = {0, 0, 0, 255}) {
inline void DrawPixel(::Color color = {0, 0, 0, 255}) const {
::DrawPixelV(*this, color);
return *this;
}
inline Vector2& DrawLine(::Vector2 endPos, ::Color color = {0, 0, 0, 255}) {
inline void DrawLine(::Vector2 endPos, ::Color color = {0, 0, 0, 255}) const {
::DrawLineV(*this, endPos, color);
return *this;
}
inline Vector2& DrawLine(::Vector2 endPos, float thick, ::Color color = {0, 0, 0, 255}) {
inline void DrawLine(::Vector2 endPos, float thick, ::Color color = {0, 0, 0, 255}) const {
::DrawLineEx(*this, endPos, thick, color);
return *this;
}
inline Vector2& DrawLineBezier(::Vector2 endPos, float thick, ::Color color = {0, 0, 0, 255}) {
inline void DrawLineBezier(::Vector2 endPos, float thick, ::Color color = {0, 0, 0, 255}) const {
::DrawLineBezier(*this, endPos, thick, color);
return *this;
}
/**
* Draw line using quadratic bezier curves with a control point.
*/
inline Vector2& DrawLineBezierQuad(
inline void DrawLineBezierQuad(
::Vector2 endPos,
::Vector2 controlPos,
float thick,
::Color color = {0, 0, 0, 255}) {
::Color color = {0, 0, 0, 255}) const {
::DrawLineBezierQuad(*this, endPos, controlPos, thick, color);
return *this;
}
/**
* Draw a color-filled circle (Vector version)
*/
inline Vector2& DrawCircle(float radius, ::Color color = {0, 0, 0, 255}) {
inline void DrawCircle(float radius, ::Color color = {0, 0, 0, 255}) const {
::DrawCircleV(*this, radius, color);
return *this;
}
inline Vector2& DrawRectangle(::Vector2 size, ::Color color = {0, 0, 0, 255}) {
inline void DrawRectangle(::Vector2 size, ::Color color = {0, 0, 0, 255}) const {
::DrawRectangleV(*this, size, color);
return *this;
}
inline Vector2& DrawPoly(int sides, float radius, float rotation, ::Color color = {0, 0, 0, 255}) {
inline void DrawPoly(int sides, float radius, float rotation, ::Color color = {0, 0, 0, 255}) const {
::DrawPoly(*this, sides, radius, rotation, color);
return *this;
}
/**

View File

@@ -264,85 +264,71 @@ class Vector3 : public ::Vector3 {
}
#endif
inline Vector3& DrawLine3D(const ::Vector3& endPos, ::Color color) {
inline void DrawLine3D(const ::Vector3& endPos, ::Color color) const {
::DrawLine3D(*this, endPos, color);
return *this;
}
inline Vector3& DrawPoint3D(::Color color) {
inline void DrawPoint3D(::Color color) const {
::DrawPoint3D(*this, color);
return *this;
}
inline Vector3& DrawCircle3D(
inline void DrawCircle3D(
float radius,
const ::Vector3& rotationAxis,
float rotationAngle,
Color color) {
Color color) const {
::DrawCircle3D(*this, radius, rotationAxis, rotationAngle, color);
return *this;
}
inline Vector3& DrawCube(float width, float height, float length, ::Color color) {
inline void DrawCube(float width, float height, float length, ::Color color) const {
::DrawCube(*this, width, height, length, color);
return *this;
}
inline Vector3& DrawCube(const ::Vector3& size, ::Color color) {
inline void DrawCube(const ::Vector3& size, ::Color color) const {
::DrawCubeV(*this, size, color);
return *this;
}
inline Vector3& DrawCubeWires(float width, float height, float length, ::Color color) {
inline void DrawCubeWires(float width, float height, float length, ::Color color) const {
::DrawCubeWires(*this, width, height, length, color);
return *this;
}
inline Vector3& DrawCubeWires(const ::Vector3& size, ::Color color) {
inline void DrawCubeWires(const ::Vector3& size, ::Color color) const {
::DrawCubeWiresV(*this, size, color);
return *this;
}
inline Vector3& DrawCubeTexture(
inline void DrawCubeTexture(
const ::Texture2D& texture,
float width,
float height,
float length,
::Color color) {
::Color color) const {
::DrawCubeTexture(texture, *this, width, height, length, color);
return *this;
}
inline Vector3& DrawSphere(float radius, ::Color color) {
inline void DrawSphere(float radius, ::Color color) const {
::DrawSphere(*this, radius, color);
return *this;
}
inline Vector3& DrawSphere(float radius, int rings, int slices, ::Color color) {
inline void DrawSphere(float radius, int rings, int slices, ::Color color) const {
::DrawSphereEx(*this, radius, rings, slices, color);
return *this;
}
inline Vector3& DrawSphereWires(float radius, int rings, int slices, ::Color color) {
inline void DrawSphereWires(float radius, int rings, int slices, ::Color color) const {
::DrawSphereWires(*this, radius, rings, slices, color);
return *this;
}
inline Vector3& DrawCylinder(float radiusTop, float radiusBottom, float height,
int slices, Color color) {
inline void DrawCylinder(float radiusTop, float radiusBottom, float height,
int slices, ::Color color) const {
::DrawCylinder(*this, radiusTop, radiusBottom, height, slices, color);
return *this;
}
inline Vector3& DrawCylinderWires(float radiusTop, float radiusBottom, float height,
int slices, Color color) {
inline void DrawCylinderWires(float radiusTop, float radiusBottom, float height,
int slices, ::Color color) const {
::DrawCylinderWires(*this, radiusTop, radiusBottom, height, slices, color);
return *this;
}
inline Vector3& DrawPlane(const ::Vector2& size, ::Color color) {
inline void DrawPlane(const ::Vector2& size, ::Color color) const {
::DrawPlane(*this, size, color);
return *this;
}
/**

View File

@@ -384,9 +384,8 @@ class Window {
/**
* Draw current FPS
*/
inline Window& DrawFPS(int posX = 10, int posY = 10) {
inline void DrawFPS(int posX = 10, int posY = 10) const {
::DrawFPS(posX, posY);
return *this;
}
/**