Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/BoundingBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ class BoundingBox : public ::BoundingBox {
return *this;
}

[[nodiscard]] std::string ToString() const {
return TextFormat(
"BoundingBox(min=(%f, %f, %f), max=(%f, %f, %f))",
min.x, min.y, min.z, max.x, max.y, max.z
);
}

operator std::string() const { return ToString(); }

/**
* Draw a bounding box with wires
*/
Expand Down
11 changes: 11 additions & 0 deletions include/Camera3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ class Camera3D : public ::Camera3D {
return *this;
}

[[nodiscard]] std::string ToString() const {
return TextFormat(
"Camera3D(position=(%f, %f, %f), target=(%f, %f, %f), fovy=%f)",
position.x, position.y, position.z,
target.x, target.y, target.z,
fovy
);
}

operator std::string() const { return ToString(); }

/**
* Initializes 3D mode with custom camera (3D)
*/
Expand Down
4 changes: 4 additions & 0 deletions include/Image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ class Image : public ::Image {
other.format = 0;
}

[[nodiscard]] std::string ToString() const { return TextFormat("Image(width=%d, height=%d)", width, height); }

operator std::string() const { return ToString(); }

static ::Image Text(const std::string& text, int fontSize, ::Color color = {255, 255, 255, 255}) {
return ::ImageText(text.c_str(), fontSize, color);
}
Expand Down
17 changes: 17 additions & 0 deletions include/Matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ class Matrix : public ::Matrix {

constexpr bool operator!=(const ::Matrix& other) { return !(*this == other); }

[[nodiscard]] std::string ToString() const {
return TextFormat(
"Matrix(\n"
" %f, %f, %f, %f\n"
" %f, %f, %f, %f\n"
" %f, %f, %f, %f\n"
" %f, %f, %f, %f\n"
")",
m0, m4, m8, m12,
m1, m5, m9, m13,
m2, m6, m10, m14,
m3, m7, m11, m15
);
}

operator std::string() const { return ToString(); }

#ifndef RAYLIB_CPP_NO_MATH
/**
* Returns the trace of the matrix (sum of the values along the diagonal)
Expand Down
9 changes: 9 additions & 0 deletions include/MeshUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ class MeshUnmanaged : public ::Mesh {
return *this;
}

[[nodiscard]] std::string ToString() const {
return TextFormat(
"Mesh(vertexCount=%d, triangleCount=%d, boneCount=%d)",
vertexCount, triangleCount, boneCount
);
}

operator std::string() const { return ToString(); }

/**
* Unload mesh from memory (RAM and/or VRAM)
*/
Expand Down
4 changes: 4 additions & 0 deletions include/ModelUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class ModelUnmanaged : public ::Model {
return *this;
}

[[nodiscard]] std::string ToString() const { return TextFormat("Model(meshCount=%d, materialCount=%d)", meshCount, materialCount); }

operator std::string() const { return ToString(); }

/**
* Loads a Model from the given file.
*
Expand Down
4 changes: 4 additions & 0 deletions include/MusicUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class MusicUnmanaged : public ::Music {
return *this;
}

[[nodiscard]] std::string ToString() const { return TextFormat("Music(frameCount=%u, looping=%s)", frameCount, looping ? "true" : "false"); }

operator std::string() const { return ToString(); }

/**
* Load music stream from file.
*
Expand Down
12 changes: 12 additions & 0 deletions include/RayCollision.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ class RayCollision : public ::RayCollision {
return *this;
}

[[nodiscard]] std::string ToString() const {
return TextFormat(
"RayCollision(hit=%s, distance=%f, point=(%f, %f, %f), normal=(%f, %f, %f))",
hit ? "true" : "false",
distance,
point.x, point.y, point.z,
normal.x, normal.y, normal.z
);
}

operator std::string() const { return ToString(); }

GETTERSETTER(bool, Hit, hit)
GETTERSETTER(float, Distance, distance)
GETTERSETTER(::Vector3, Position, point)
Expand Down
4 changes: 4 additions & 0 deletions include/Rectangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class Rectangle : public ::Rectangle {

constexpr explicit operator ::Vector4() const { return {x, y, width, height}; }

[[nodiscard]] std::string ToString() const { return TextFormat("Rectangle(%fx%f, %fx%f)", x, y, width, height); }

operator std::string() const { return ToString(); }

/**
* Draw a color-filled rectangle
*/
Expand Down
4 changes: 4 additions & 0 deletions include/RenderTextureUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class RenderTextureUnmanaged : public ::RenderTexture {
*/
RenderTextureUnmanaged(int width, int height) { Load(width, height); }

[[nodiscard]] std::string ToString() const { return TextFormat("RenderTexture(id=%u)", id); }

operator std::string() const { return ToString(); }

GETTER(unsigned int, Id, id)

/**
Expand Down
4 changes: 4 additions & 0 deletions include/ShaderUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class ShaderUnmanaged : public ::Shader {
return *this;
}

[[nodiscard]] std::string ToString() const { return TextFormat("Shader(id=%u)", id); }

operator std::string() const { return ToString(); }

/**
* Begin custom shader drawing.
*/
Expand Down
4 changes: 4 additions & 0 deletions include/SoundUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class SoundUnmanaged : public ::Sound {
return *this;
}

[[nodiscard]] std::string ToString() const { return TextFormat("Sound(frameCount=%u)", frameCount); }

operator std::string() const { return ToString(); }

/**
* Load a sound from the given file.
*
Expand Down
4 changes: 4 additions & 0 deletions include/TextureUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class TextureUnmanaged : public ::Texture {
return *this;
}

[[nodiscard]] std::string ToString() const { return TextFormat("Texture(id=%u, %dx%d)", id, width, height); }

operator std::string() const { return ToString(); }

/**
* Retrieve the width and height of the texture.
*/
Expand Down
9 changes: 9 additions & 0 deletions include/WaveUnmanaged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ class WaveUnmanaged : public ::Wave {
return *this;
}

[[nodiscard]] std::string ToString() const {
return TextFormat(
"Wave(frameCount=%u, sampleRate=%u, sampleSize=%u, channels=%u, data=%p)",
frameCount, sampleRate, sampleSize, channels, data
);
}

operator std::string() const { return ToString(); }

/**
* Load wave data from file.
*
Expand Down
4 changes: 4 additions & 0 deletions include/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class Window {
*/
~Window() { Close(); }

[[nodiscard]] std::string ToString() const { return TextFormat("Window(%dx%d)", GetWidth(), GetHeight()); }

operator std::string() const { return ToString(); }

/**
* Initializes the window.
*
Expand Down
Loading