MCPcopy Create free account
hub / github.com/RobLoach/raylib-cpp / Vector4

Class Vector4

include/Vector4.hpp:21–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 * Vector4 type
20 */
21class Vector4 : public ::Vector4 {
22public:
23 constexpr Vector4(const ::Vector4& vec) : ::Vector4{vec.x, vec.y, vec.z, vec.w} {}
24 explicit constexpr Vector4(const raylib::Quaternion quat) : ::Vector4{quat.x, quat.y, quat.z, quat.w} {}
25
26 explicit constexpr Vector4(const float x = 0, const float y = 0, const float z = 0, const float w = 0) : ::Vector4{x, y, z, w} {}
27 explicit constexpr Vector4(const ::Rectangle rectangle) : ::Vector4{rectangle.x, rectangle.y, rectangle.width, rectangle.height} {}
28
29 explicit Vector4(const ::Color color) { set(ColorNormalize(color)); }
30
31 GETTERSETTER(float, X, x)
32 GETTERSETTER(float, Y, y)
33 GETTERSETTER(float, Z, z)
34 GETTERSETTER(float, W, w)
35
36 Vector4& operator=(const ::Vector4& vector4) {
37 set(vector4);
38 return *this;
39 }
40
41 /*
42 * An exact value by value equality comparison.
43 * Due to floating point inaccuracies consider using Equals instead.
44 */
45 constexpr bool operator==(const ::Vector4& other) const {
46 return x == other.x && y == other.y && z == other.z && w == other.w;
47 }
48
49 /*
50 * An exact value by value inequality comparison.
51 * Due to floating point inaccuracies consider using Equals instead.
52 */
53 constexpr bool operator!=(const ::Vector4& other) const { return !(*this == other); }
54
55 RLCPP_NODISCARD constexpr ::Rectangle ToRectangle() const { return {x, y, z, w}; }
56
57 constexpr operator ::Rectangle() const { return {x, y, z, w}; }
58
59 RLCPP_NODISCARD std::string ToString() const { return ::TextFormat("Vector4(%f, %f, %f, %f)", x, y, z, w); }
60
61 operator std::string() const { return ToString(); }
62

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected