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
6 changes: 3 additions & 3 deletions include/BoundingBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BoundingBox : public ::BoundingBox {
/*
* Copy a bounding box from another bounding box.
*/
BoundingBox(const ::BoundingBox& box) : ::BoundingBox{box.min, box.max} {
constexpr BoundingBox(const ::BoundingBox& box) : ::BoundingBox{box.min, box.max} {
// Nothing.
}

Expand All @@ -22,8 +22,8 @@ class BoundingBox : public ::BoundingBox {
*/
BoundingBox(const ::Mesh& mesh) { set(::GetMeshBoundingBox(mesh)); }

BoundingBox(::Vector3 minMax = ::Vector3{0.0f, 0.0f, 0.0f}) : ::BoundingBox{minMax, minMax} {}
BoundingBox(::Vector3 min, ::Vector3 max) : ::BoundingBox{min, max} {}
constexpr BoundingBox(::Vector3 minMax = ::Vector3{0.0f, 0.0f, 0.0f}) : ::BoundingBox{minMax, minMax} {}
constexpr BoundingBox(::Vector3 min, ::Vector3 max) : ::BoundingBox{min, max} {}

GETTERSETTER(::Vector3, Min, min)
GETTERSETTER(::Vector3, Max, max)
Expand Down
6 changes: 3 additions & 3 deletions include/Color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ namespace raylib {
*/
class Color : public ::Color {
public:
Color(const ::Color& color) : ::Color{color.r, color.g, color.b, color.a} {}
constexpr Color(const ::Color& color) : ::Color{color.r, color.g, color.b, color.a} {}

Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255)
constexpr Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255)
: ::Color{red, green, blue, alpha} {};

/**
* Black.
*/
Color() : ::Color{0, 0, 0, 255} {};
constexpr Color() : ::Color{0, 0, 0, 255} {};

/**
* Returns a Color from HSV values
Expand Down
8 changes: 4 additions & 4 deletions include/Matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ namespace raylib {
*/
class Matrix : public ::Matrix {
public:
Matrix(const ::Matrix& mat)
constexpr Matrix(const ::Matrix& mat)
: ::Matrix(mat) {
// Nothing.
}

Matrix(
constexpr Matrix(
float m0 = 0,
float m4 = 0,
float m8 = 0,
Expand Down Expand Up @@ -72,14 +72,14 @@ class Matrix : public ::Matrix {
return *this;
}

bool operator==(const ::Matrix& other) {
constexpr bool operator==(const ::Matrix& other) {
return m0 == other.m0 && m1 == other.m1 && m2 == other.m2 && m3 == other.m3 && m4 == other.m4 &&
m5 == other.m5 && m6 == other.m6 && m7 == other.m7 && m8 == other.m8 && m9 == other.m9 &&
m10 == other.m10 && m11 == other.m11 && m12 == other.m12 && m13 == other.m13 && m14 == other.m14 &&
m15 == other.m15;
}

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

#ifndef RAYLIB_CPP_NO_MATH
/**
Expand Down
2 changes: 1 addition & 1 deletion include/Ray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Ray : public ::Ray {
public:
Ray(const ::Ray& ray) { set(ray); }

Ray(::Vector3 position = {0.0f, 0.0f, 0.0f}, ::Vector3 direction = {0.0f, 0.0f, 0.0f})
constexpr Ray(::Vector3 position = {0.0f, 0.0f, 0.0f}, ::Vector3 direction = {0.0f, 0.0f, 0.0f})
: ::Ray{position, direction} {
// Nothing.
}
Expand Down
2 changes: 1 addition & 1 deletion include/RayCollision.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RayCollision : public ::RayCollision {
public:
RayCollision(const ::RayCollision& ray) : ::RayCollision(ray) { }

RayCollision(bool hit, float distance, ::Vector3 point, ::Vector3 normal)
constexpr RayCollision(bool hit, float distance, ::Vector3 point, ::Vector3 normal)
: ::RayCollision{hit, distance, point, normal} {
// Nothing.
}
Expand Down
22 changes: 11 additions & 11 deletions include/Rectangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ namespace raylib {
*/
class Rectangle : public ::Rectangle {
public:
Rectangle(const ::Rectangle& rect) : ::Rectangle{rect.x, rect.y, rect.width, rect.height} {}
constexpr Rectangle(const ::Rectangle& rect) : ::Rectangle{rect.x, rect.y, rect.width, rect.height} {}

Rectangle(float x, float y, float width, float height) : ::Rectangle{x, y, width, height} {}
Rectangle(float x, float y, float width) : ::Rectangle{x, y, width, 0} {}
Rectangle(float x, float y) : ::Rectangle{x, y, 0, 0} {}
Rectangle(float x) : ::Rectangle{x, 0, 0, 0} {}
Rectangle() : ::Rectangle{0, 0, 0, 0} {}
constexpr Rectangle(float x, float y, float width, float height) : ::Rectangle{x, y, width, height} {}
constexpr Rectangle(float x, float y, float width) : ::Rectangle{x, y, width, 0} {}
constexpr Rectangle(float x, float y) : ::Rectangle{x, y, 0, 0} {}
constexpr Rectangle(float x) : ::Rectangle{x, 0, 0, 0} {}
constexpr Rectangle() : ::Rectangle{0, 0, 0, 0} {}

Rectangle(::Vector2 position, ::Vector2 size) : ::Rectangle{position.x, position.y, size.x, size.y} {}
Rectangle(::Vector2 size) : ::Rectangle{0, 0, size.x, size.y} {}
Rectangle(::Vector4 rect) : ::Rectangle{rect.x, rect.y, rect.z, rect.w} {}
constexpr Rectangle(::Vector2 position, ::Vector2 size) : ::Rectangle{position.x, position.y, size.x, size.y} {}
constexpr Rectangle(::Vector2 size) : ::Rectangle{0, 0, size.x, size.y} {}
constexpr Rectangle(::Vector4 rect) : ::Rectangle{rect.x, rect.y, rect.z, rect.w} {}

GETTERSETTER(float, X, x)
GETTERSETTER(float, Y, y)
Expand All @@ -33,9 +33,9 @@ class Rectangle : public ::Rectangle {
return *this;
}

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

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

/**
* Draw a color-filled rectangle
Expand Down
12 changes: 6 additions & 6 deletions include/Vector2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ namespace raylib {
*/
class Vector2 : public ::Vector2 {
public:
Vector2(const ::Vector2& vec) : ::Vector2{vec.x, vec.y} {}
constexpr Vector2(const ::Vector2& vec) : ::Vector2{vec.x, vec.y} {}

Vector2(float x, float y) : ::Vector2{x, y} {}
Vector2(float x) : ::Vector2{x, 0} {}
Vector2() : ::Vector2{0, 0} {}
constexpr Vector2(float x, float y) : ::Vector2{x, y} {}
constexpr Vector2(float x) : ::Vector2{x, 0} {}
constexpr Vector2() : ::Vector2{0, 0} {}

GETTERSETTER(float, X, x)
GETTERSETTER(float, Y, y)
Expand All @@ -37,12 +37,12 @@ class Vector2 : public ::Vector2 {
/**
* Determine whether or not the vectors are equal.
*/
bool operator==(const ::Vector2& other) const { return x == other.x && y == other.y; }
constexpr bool operator==(const ::Vector2& other) const { return x == other.x && y == other.y; }

/**
* Determines if the vectors are not equal.
*/
bool operator!=(const ::Vector2& other) const { return !(*this == other); }
constexpr bool operator!=(const ::Vector2& other) const { return !(*this == other); }

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

Expand Down
14 changes: 7 additions & 7 deletions include/Vector3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace raylib {
*/
class Vector3 : public ::Vector3 {
public:
Vector3(const ::Vector3& vec) : ::Vector3{vec.x, vec.y, vec.z} {}
constexpr Vector3(const ::Vector3& vec) : ::Vector3{vec.x, vec.y, vec.z} {}

Vector3(float x, float y, float z) : ::Vector3{x, y, z} {}
Vector3(float x, float y) : ::Vector3{x, y, 0} {}
Vector3(float x) : ::Vector3{x, 0, 0} {}
Vector3() : ::Vector3{0, 0, 0} {}
constexpr Vector3(float x, float y, float z) : ::Vector3{x, y, z} {}
constexpr Vector3(float x, float y) : ::Vector3{x, y, 0} {}
constexpr Vector3(float x) : ::Vector3{x, 0, 0} {}
constexpr Vector3() : ::Vector3{0, 0, 0} {}

Vector3(::Color color) { set(ColorToHSV(color)); }

Expand All @@ -35,9 +35,9 @@ class Vector3 : public ::Vector3 {
return *this;
}

bool operator==(const ::Vector3& other) const { return x == other.x && y == other.y && z == other.z; }
constexpr bool operator==(const ::Vector3& other) const { return x == other.x && y == other.y && z == other.z; }

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

[[nodiscard]] std::string ToString() const { return TextFormat("Vector3(%f, %f, %f)", x, y, z); }

Expand Down
22 changes: 11 additions & 11 deletions include/Vector4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ namespace raylib {
*/
class Vector4 : public ::Vector4 {
public:
Vector4(const ::Vector4& vec) : ::Vector4{vec.x, vec.y, vec.z, vec.w} {}
constexpr Vector4(const ::Vector4& vec) : ::Vector4{vec.x, vec.y, vec.z, vec.w} {}

Vector4(float x, float y, float z, float w) : ::Vector4{x, y, z, w} {}
Vector4(float x, float y, float z) : ::Vector4{x, y, z, 0} {}
Vector4(float x, float y) : ::Vector4{x, y, 0, 0} {}
Vector4(float x) : ::Vector4{x, 0, 0, 0} {}
Vector4() : ::Vector4{0, 0, 0, 0} {}
Vector4(::Rectangle rectangle) : ::Vector4{rectangle.x, rectangle.y, rectangle.width, rectangle.height} {}
constexpr Vector4(float x, float y, float z, float w) : ::Vector4{x, y, z, w} {}
constexpr Vector4(float x, float y, float z) : ::Vector4{x, y, z, 0} {}
constexpr Vector4(float x, float y) : ::Vector4{x, y, 0, 0} {}
constexpr Vector4(float x) : ::Vector4{x, 0, 0, 0} {}
constexpr Vector4() : ::Vector4{0, 0, 0, 0} {}
constexpr Vector4(::Rectangle rectangle) : ::Vector4{rectangle.x, rectangle.y, rectangle.width, rectangle.height} {}

Vector4(::Color color) { set(ColorNormalize(color)); }

Expand All @@ -39,15 +39,15 @@ class Vector4 : public ::Vector4 {
return *this;
}

bool operator==(const ::Vector4& other) const {
constexpr bool operator==(const ::Vector4& other) const {
return x == other.x && y == other.y && z == other.z && w == other.w;
}

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

[[nodiscard]] ::Rectangle ToRectangle() const { return {x, y, z, w}; }
[[nodiscard]] constexpr ::Rectangle ToRectangle() const { return {x, y, z, w}; }

operator ::Rectangle() const { return {x, y, z, w}; }
constexpr operator ::Rectangle() const { return {x, y, z, w}; }

[[nodiscard]] std::string ToString() const { return TextFormat("Vector4(%f, %f, %f, %f)", x, y, z, w); }

Expand Down
Loading