diff --git a/include/Color.hpp b/include/Color.hpp index 0881c7f..60c1771 100644 --- a/include/Color.hpp +++ b/include/Color.hpp @@ -66,6 +66,16 @@ class Color : public ::Color { return ::ColorToInt(*this); } + inline std::string ToString() const { + std::ostringstream oss; + oss << "Color(" << r << ", " << g << ", " << b << ", " << a << ")"; + return oss.str(); + } + + inline operator std::string() const { + return ToString(); + } + /** * Returns color with alpha applied, alpha goes from 0.0f to 1.0f */ @@ -210,13 +220,6 @@ class Color : public ::Color { return ::ColorAlphaBlend(dst, *this, tint); } - inline std::string ToString() const - { - std::ostringstream oss; - oss << "Color(" << r << ", " << g << ", " << b << ", " << a << ")"; - return oss.str(); - } - inline static Color LightGray() { return LIGHTGRAY; } inline static Color Gray() { return GRAY; } inline static Color DarkGray() { return DARKGRAY; } diff --git a/include/Vector2.hpp b/include/Vector2.hpp index 3404615..2e680e9 100644 --- a/include/Vector2.hpp +++ b/include/Vector2.hpp @@ -49,6 +49,16 @@ class Vector2 : public ::Vector2 { return !(*this == other); } + inline std::string ToString() const { + std::ostringstream oss; + oss << "Vector2(" << x << ", " << y << ")"; + return oss.str(); + } + + inline operator std::string() const { + return ToString(); + } + #ifndef RAYLIB_CPP_NO_MATH /** * Add two vectors (v1 + v2) @@ -424,13 +434,6 @@ class Vector2 : public ::Vector2 { return ::CheckCollisionPointLine(*this, p1, p2, threshold); } - inline std::string ToString() const - { - std::ostringstream oss; - oss << "Vector2(" << x << ", " << y << ")"; - return oss.str(); - } - private: void set(const ::Vector2& vec) { x = vec.x; diff --git a/include/Vector3.hpp b/include/Vector3.hpp index c28f681..ecff785 100644 --- a/include/Vector3.hpp +++ b/include/Vector3.hpp @@ -47,6 +47,16 @@ class Vector3 : public ::Vector3 { return !(*this == other); } + inline std::string ToString() const { + std::ostringstream oss; + oss << "Vector3(" << x << ", " << y << ", " << z << ")"; + return oss.str(); + } + + inline operator std::string() const { + return ToString(); + } + #ifndef RAYLIB_CPP_NO_MATH /** * Add two vectors @@ -331,13 +341,6 @@ class Vector3 : public ::Vector3 { return CheckCollisionSpheres(*this, radius1, center2, radius2); } - inline std::string ToString() const - { - std::ostringstream oss; - oss << "Vector3(" << x << ", " << y << ", " << z << ")"; - return oss.str(); - } - private: void set(const ::Vector3& vec) { x = vec.x; diff --git a/include/Vector4.hpp b/include/Vector4.hpp index 556c80c..f359196 100644 --- a/include/Vector4.hpp +++ b/include/Vector4.hpp @@ -60,6 +60,16 @@ class Vector4 : public ::Vector4 { return {x, y, z, w}; } + inline std::string ToString() const { + std::ostringstream oss; + oss << "Vector4(" << x << ", " << y << ", " << z << ", " << w << ")"; + return oss.str(); + } + + inline operator std::string() const { + return ToString(); + } + #ifndef RAYLIB_CPP_NO_MATH inline Vector4 Multiply(const ::Vector4& vector4) const { return QuaternionMultiply(*this, vector4); @@ -153,13 +163,6 @@ class Vector4 : public ::Vector4 { return ColorFromNormalized(); } - inline std::string ToString() const - { - std::ostringstream oss; - oss << "Vector4(" << x << ", " << y << ", " << z << ", " << w << ")"; - return oss.str(); - } - private: void set(const ::Vector4& vec4) { x = vec4.x;