diff --git a/include/Color.hpp b/include/Color.hpp index 6b84b2f5..783a7b6b 100644 --- a/include/Color.hpp +++ b/include/Color.hpp @@ -65,6 +65,14 @@ class Color : public ::Color { return ::ColorToInt(*this); } + inline std::string ToString() const { + return TextFormat("Color(%d, %d, %d, %d)", r, g, b, a); + } + + inline operator std::string() const { + return ToString(); + } + /** * Returns color with alpha applied, alpha goes from 0.0f to 1.0f */ diff --git a/include/Vector2.hpp b/include/Vector2.hpp index ca3d3fc7..00f59dee 100644 --- a/include/Vector2.hpp +++ b/include/Vector2.hpp @@ -47,6 +47,14 @@ class Vector2 : public ::Vector2 { return !(*this == other); } + inline std::string ToString() const { + return TextFormat("Vector2(%f, %f)", x, y); + } + + inline operator std::string() const { + return ToString(); + } + #ifndef RAYLIB_CPP_NO_MATH /** * Add two vectors (v1 + v2) diff --git a/include/Vector3.hpp b/include/Vector3.hpp index 04e9fdb0..b5e52be9 100644 --- a/include/Vector3.hpp +++ b/include/Vector3.hpp @@ -45,6 +45,14 @@ class Vector3 : public ::Vector3 { return !(*this == other); } + inline std::string ToString() const { + return TextFormat("Vector3(%f, %f, %f)", x, y, z); + } + + inline operator std::string() const { + return ToString(); + } + #ifndef RAYLIB_CPP_NO_MATH /** * Add two vectors diff --git a/include/Vector4.hpp b/include/Vector4.hpp index 69013930..a87e807f 100644 --- a/include/Vector4.hpp +++ b/include/Vector4.hpp @@ -58,6 +58,14 @@ class Vector4 : public ::Vector4 { return {x, y, z, w}; } + inline std::string ToString() const { + return TextFormat("Vector4(%f, %f, %f, %f)", x, y, z, w); + } + + inline operator std::string() const { + return ToString(); + } + #ifndef RAYLIB_CPP_NO_MATH inline Vector4 Multiply(const ::Vector4& vector4) const { return QuaternionMultiply(*this, vector4);