diff --git a/include/Color.hpp b/include/Color.hpp index 6b84b2f..783a7b6 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 123035e..e633f55 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 74eafb6..9d65e8e 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 09d3192..f406ef3 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);