From 0512882df3e54df44eeacc5db62efc3c52fe82ba Mon Sep 17 00:00:00 2001 From: AbubakrBardien Date: Sun, 25 Oct 2026 19:02:15 +0200 Subject: [PATCH 1/2] Applied the '.clang-format' rules to 'Vector2.hpp', 'Vector3.hpp' and 'Vector4.hpp' --- include/Vector2.hpp | 25 ++++++++----------------- include/Vector3.hpp | 25 ++++++++----------------- include/Vector4.hpp | 27 ++++++++++----------------- 3 files changed, 26 insertions(+), 51 deletions(-) diff --git a/include/Vector2.hpp b/include/Vector2.hpp index f635996c..de9a85c0 100644 --- a/include/Vector2.hpp +++ b/include/Vector2.hpp @@ -13,7 +13,7 @@ namespace raylib { * Vector2 type */ class Vector2 : public ::Vector2 { - public: +public: constexpr Vector2(const ::Vector2& vec) : ::Vector2{vec.x, vec.y} {} constexpr Vector2(float x = 0, float y = 0) : ::Vector2{x, y} {} @@ -66,16 +66,12 @@ class Vector2 : public ::Vector2 { /** * Add vector and float value */ - Vector2 Add(float value) const { - return Vector2AddValue(*this, value); - } + Vector2 Add(float value) const { return Vector2AddValue(*this, value); } /** * Add vector and float value */ - Vector2 operator+(float value) const { - return Vector2AddValue(*this, value); - } + Vector2 operator+(float value) const { return Vector2AddValue(*this, value); } /** * Add vector and float value @@ -108,16 +104,12 @@ class Vector2 : public ::Vector2 { /** * Subtract vector by float value */ - RLCPP_NODISCARD Vector2 Subtract(float value) const { - return Vector2SubtractValue(*this, value); - } + RLCPP_NODISCARD Vector2 Subtract(float value) const { return Vector2SubtractValue(*this, value); } /** * Subtract vector by float value */ - Vector2 operator-(float value) const { - return Vector2SubtractValue(*this, value); - } + Vector2 operator-(float value) const { return Vector2SubtractValue(*this, value); } /** * Subtract vector by float value @@ -381,16 +373,15 @@ class Vector2 : public ::Vector2 { RLCPP_NODISCARD bool CheckCollisionPointLine(::Vector2 p1, ::Vector2 p2, int threshold = 1) const { return ::CheckCollisionPointLine(*this, p1, p2, threshold); } - - protected: +protected: void set(const ::Vector2& vec) { x = vec.x; y = vec.y; } }; -} // namespace raylib +} // namespace raylib using RVector2 = raylib::Vector2; -#endif // RAYLIB_CPP_INCLUDE_VECTOR2_HPP_ +#endif // RAYLIB_CPP_INCLUDE_VECTOR2_HPP_ diff --git a/include/Vector3.hpp b/include/Vector3.hpp index f5e75420..e3997366 100644 --- a/include/Vector3.hpp +++ b/include/Vector3.hpp @@ -12,7 +12,7 @@ namespace raylib { * Vector3 type */ class Vector3 : public ::Vector3 { - public: +public: constexpr Vector3(const ::Vector3& vec) : ::Vector3{vec.x, vec.y, vec.z} {} constexpr Vector3(float x = 0, float y = 0, float z = 0) : ::Vector3{x, y, z} {} @@ -56,16 +56,12 @@ class Vector3 : public ::Vector3 { /** * Add vector and float value */ - RLCPP_NODISCARD Vector3 Add(float value) const { - return Vector3AddValue(*this, value); - } + RLCPP_NODISCARD Vector3 Add(float value) const { return Vector3AddValue(*this, value); } /** * Add vector and float value */ - Vector3 operator+(float value) const { - return Vector3AddValue(*this, value); - } + Vector3 operator+(float value) const { return Vector3AddValue(*this, value); } Vector3& operator+=(float value) { set(Vector3AddValue(*this, value)); @@ -92,16 +88,12 @@ class Vector3 : public ::Vector3 { /** * Subtract vector by float value */ - RLCPP_NODISCARD Vector3 Subtract(float value) const { - return Vector3SubtractValue(*this, value); - } + RLCPP_NODISCARD Vector3 Subtract(float value) const { return Vector3SubtractValue(*this, value); } /** * Subtract vector by float value */ - Vector3 operator-(float value) const { - return Vector3SubtractValue(*this, value); - } + Vector3 operator-(float value) const { return Vector3SubtractValue(*this, value); } Vector3& operator-=(float value) { set(Vector3SubtractValue(*this, value)); @@ -296,16 +288,15 @@ class Vector3 : public ::Vector3 { RLCPP_NODISCARD bool CheckCollision(float radius1, const ::Vector3& center2, float radius2) const { return CheckCollisionSpheres(*this, radius1, center2, radius2); } - - protected: +protected: void set(const ::Vector3& vec) { x = vec.x; y = vec.y; z = vec.z; } }; -} // namespace raylib +} // namespace raylib using RVector3 = raylib::Vector3; -#endif // RAYLIB_CPP_INCLUDE_VECTOR3_HPP_ +#endif // RAYLIB_CPP_INCLUDE_VECTOR3_HPP_ diff --git a/include/Vector4.hpp b/include/Vector4.hpp index b48b2dd9..5fca5f00 100644 --- a/include/Vector4.hpp +++ b/include/Vector4.hpp @@ -15,7 +15,7 @@ class Quaternion : public ::Quaternion {}; * Vector4 type */ class Vector4 : public ::Vector4 { - public: +public: constexpr Vector4(const ::Vector4& vec) : ::Vector4{vec.x, vec.y, vec.z, vec.w} {} explicit constexpr Vector4(const raylib::Quaternion quat) : ::Vector4{quat.x, quat.y, quat.z, quat.w} {} @@ -82,16 +82,12 @@ class Vector4 : public ::Vector4 { /** * Add vector and float value */ - RLCPP_NODISCARD Vector4 Add(const float value) const { - return ::Vector4AddValue(*this, value); - } + RLCPP_NODISCARD Vector4 Add(const float value) const { return ::Vector4AddValue(*this, value); } /** * Add vector and float value */ - Vector4 operator+(const float value) const { - return ::Vector4AddValue(*this, value); - } + Vector4 operator+(const float value) const { return ::Vector4AddValue(*this, value); } /** * Add vector and float value @@ -126,16 +122,12 @@ class Vector4 : public ::Vector4 { /** * Subtract vector by float value */ - RLCPP_NODISCARD Vector4 Subtract(const float value) const { - return ::Vector4SubtractValue(*this, value); - } + RLCPP_NODISCARD Vector4 Subtract(const float value) const { return ::Vector4SubtractValue(*this, value); } /** * Subtract vector by float value */ - Vector4 operator-(const float value) const { - return ::Vector4SubtractValue(*this, value); - } + Vector4 operator-(const float value) const { return ::Vector4SubtractValue(*this, value); } /** * Subtract vector by float value @@ -251,12 +243,14 @@ class Vector4 : public ::Vector4 { * Divide vector components by value */ constexpr friend Vector4 operator/(const float lhs, const Vector4& rhs) { + // clang-format off return Vector4{ lhs / rhs.x, lhs / rhs.y, lhs / rhs.z, lhs / rhs.w }; + // clang-format on } RLCPP_NODISCARD float Length() const { return ::Vector4Length(*this); } @@ -296,8 +290,7 @@ class Vector4 : public ::Vector4 { RLCPP_NODISCARD Color ColorFromNormalized() const { return ::ColorFromNormalized(*this); } operator Color() const { return ColorFromNormalized(); } - - protected: +protected: void set(const ::Vector4& vec4) { x = vec4.x; y = vec4.y; @@ -306,8 +299,8 @@ class Vector4 : public ::Vector4 { } }; -} // namespace raylib +} // namespace raylib using RVector4 = raylib::Vector4; -#endif // RAYLIB_CPP_INCLUDE_VECTOR4_HPP_ +#endif // RAYLIB_CPP_INCLUDE_VECTOR4_HPP_ From 378dbfd0720d5f4ed1e8b9b69188bf231fbcd58b Mon Sep 17 00:00:00 2001 From: AbubakrBardien Date: Mon, 26 Oct 2026 22:21:05 +0200 Subject: [PATCH 2/2] Adjusted the '.clang-format' file to avoid warnings from cpplint --- .clang-format | 6 +++--- include/Vector2.hpp | 9 +++++---- include/Vector3.hpp | 9 +++++---- include/Vector4.hpp | 9 +++++---- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.clang-format b/.clang-format index 3caf6acd..d93d5ca3 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ --- Language: Cpp BasedOnStyle: Google -AccessModifierOffset: -4 +AccessModifierOffset: -3 AlignAfterOpenBracket: AlwaysBreak AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false @@ -60,7 +60,7 @@ Cpp11BracedListStyle: true DeriveLineEnding: true DerivePointerAlignment: false DisableFormat: false -EmptyLineBeforeAccessModifier: Never +EmptyLineBeforeAccessModifier: Always EmptyLineAfterAccessModifier: Never ExperimentalAutoDetectBinPacking: false IndentCaseLabels: true @@ -111,7 +111,7 @@ SpaceBeforeParensOptions: AfterIfMacros: false SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 +SpacesBeforeTrailingComments: 2 SpacesInAngles: false SpacesInContainerLiterals: false SpacesInCStyleCastParentheses: false diff --git a/include/Vector2.hpp b/include/Vector2.hpp index de9a85c0..d6dac0b4 100644 --- a/include/Vector2.hpp +++ b/include/Vector2.hpp @@ -13,7 +13,7 @@ namespace raylib { * Vector2 type */ class Vector2 : public ::Vector2 { -public: + public: constexpr Vector2(const ::Vector2& vec) : ::Vector2{vec.x, vec.y} {} constexpr Vector2(float x = 0, float y = 0) : ::Vector2{x, y} {} @@ -373,15 +373,16 @@ class Vector2 : public ::Vector2 { RLCPP_NODISCARD bool CheckCollisionPointLine(::Vector2 p1, ::Vector2 p2, int threshold = 1) const { return ::CheckCollisionPointLine(*this, p1, p2, threshold); } -protected: + + protected: void set(const ::Vector2& vec) { x = vec.x; y = vec.y; } }; -} // namespace raylib +} // namespace raylib using RVector2 = raylib::Vector2; -#endif // RAYLIB_CPP_INCLUDE_VECTOR2_HPP_ +#endif // RAYLIB_CPP_INCLUDE_VECTOR2_HPP_ diff --git a/include/Vector3.hpp b/include/Vector3.hpp index e3997366..164e6eaa 100644 --- a/include/Vector3.hpp +++ b/include/Vector3.hpp @@ -12,7 +12,7 @@ namespace raylib { * Vector3 type */ class Vector3 : public ::Vector3 { -public: + public: constexpr Vector3(const ::Vector3& vec) : ::Vector3{vec.x, vec.y, vec.z} {} constexpr Vector3(float x = 0, float y = 0, float z = 0) : ::Vector3{x, y, z} {} @@ -288,15 +288,16 @@ class Vector3 : public ::Vector3 { RLCPP_NODISCARD bool CheckCollision(float radius1, const ::Vector3& center2, float radius2) const { return CheckCollisionSpheres(*this, radius1, center2, radius2); } -protected: + + protected: void set(const ::Vector3& vec) { x = vec.x; y = vec.y; z = vec.z; } }; -} // namespace raylib +} // namespace raylib using RVector3 = raylib::Vector3; -#endif // RAYLIB_CPP_INCLUDE_VECTOR3_HPP_ +#endif // RAYLIB_CPP_INCLUDE_VECTOR3_HPP_ diff --git a/include/Vector4.hpp b/include/Vector4.hpp index 5fca5f00..f4d87528 100644 --- a/include/Vector4.hpp +++ b/include/Vector4.hpp @@ -15,7 +15,7 @@ class Quaternion : public ::Quaternion {}; * Vector4 type */ class Vector4 : public ::Vector4 { -public: + public: constexpr Vector4(const ::Vector4& vec) : ::Vector4{vec.x, vec.y, vec.z, vec.w} {} explicit constexpr Vector4(const raylib::Quaternion quat) : ::Vector4{quat.x, quat.y, quat.z, quat.w} {} @@ -290,7 +290,8 @@ class Vector4 : public ::Vector4 { RLCPP_NODISCARD Color ColorFromNormalized() const { return ::ColorFromNormalized(*this); } operator Color() const { return ColorFromNormalized(); } -protected: + + protected: void set(const ::Vector4& vec4) { x = vec4.x; y = vec4.y; @@ -299,8 +300,8 @@ class Vector4 : public ::Vector4 { } }; -} // namespace raylib +} // namespace raylib using RVector4 = raylib::Vector4; -#endif // RAYLIB_CPP_INCLUDE_VECTOR4_HPP_ +#endif // RAYLIB_CPP_INCLUDE_VECTOR4_HPP_