raw data structure methods calls are now forbidden for functions outside RAY

This commit is contained in:
arthur.jamet
2021-05-23 16:39:31 +02:00
parent bce3d68874
commit b2c38a6adf
8 changed files with 76 additions and 62 deletions
+2
View File
@@ -99,4 +99,6 @@ if (NOT raylib_FOUND)
endif()
add_library(${LIB_NAME} STATIC ${SRC} ${HEADERS})
target_compile_definitions(${LIB_NAME} INTERFACE INTERNAL=private)
target_compile_definitions(${LIB_NAME} PRIVATE INTERNAL=public)
target_link_libraries(${LIB_NAME} raylib)
+4 -3
View File
@@ -52,11 +52,12 @@ namespace RAY::Camera {
//! @brief Returns camera 2d transform matrix
Matrix getMatrix(void) const override;
//! @brief get camera struct
operator ::Camera2D() const;
private:
::Camera2D _camera;
INTERNAL:
//! @brief get camera struct
operator ::Camera2D() const;
};
}
+4 -3
View File
@@ -62,12 +62,13 @@ namespace RAY::Camera {
// Set camera mode (multiple camera modes available)
void setMode(Mode mode);
//! @brief get camera struct
operator ::Camera3D() const;
private:
::Camera3D _camera;
Mode _mode;
INTERNAL:
//! @brief get camera struct
operator ::Camera3D() const;
};
}
+4 -2
View File
@@ -68,8 +68,6 @@ namespace RAY {
//! @return A-component of color
unsigned char getA(void) const;
//! @return color struct
operator ::Color() const;
//! @return hexadecimal value of color
int toHex(void) const;
@@ -77,6 +75,10 @@ namespace RAY {
private:
//! @brief Color, really, that's just it...
::Color _color;
INTERNAL:
//! @return color struct
operator ::Color() const;
};
};
+5 -3
View File
@@ -54,9 +54,6 @@ namespace RAY
//! @brief unload ressources
bool unload() override;
//! @brief get image
operator ::Image() const;
operator ::Image *();
//! @brief draw drawable
void draw(Drawables::ADrawable2D &);
@@ -64,6 +61,11 @@ namespace RAY
private:
//! @brief Image, really, that's just it...
::Image _image;
INTERNAL:
//! @brief get image
operator ::Image() const;
operator ::Image *();
};
}
+4 -3
View File
@@ -45,13 +45,14 @@ namespace RAY
//! @brief unload ressources
bool unload() override;
//! @return libray Texture struct
operator ::Texture() const;
protected:
private:
//! @brief Texture, really, that's just it...
::Texture _texture;
INTERNAL:
//! @return libray Texture struct
operator ::Texture() const;
};
}
+25 -23
View File
@@ -12,37 +12,39 @@
namespace RAY {
//! @brief A Two-dimensionnal Vector data type.
struct Vector2
class Vector2
{
//! @brief Vector 2 constructor
//! @param x x-value of vector, such as a width
//! @param y y-value of vector, such as a height
Vector2(float x, float y);
public:
//! @brief Vector 2 constructor
//! @param x x-value of vector, such as a width
//! @param y y-value of vector, such as a height
Vector2(float x, float y);
//! @brief Vector 2 constructor
//! @brief All values are set to zero
Vector2();
//! @brief Vector 2 constructor
//! @brief All values are set to zero
Vector2();
//! @brief A default Vector 2 copy-constructor
Vector2(const Vector2 &) = default;
//! @brief A default Vector 2 copy-constructor
Vector2(const Vector2 &) = default;
//! @brief A Vector 2 constructor from libray's vector2
Vector2(const ::Vector2 &);
//! @brief A Vector 2 constructor from libray's vector2
Vector2(const ::Vector2 &);
//! @brief A default Vector 2 destructor
~Vector2() = default;
//! @brief A default Vector 2 destructor
~Vector2() = default;
//! @brief A Vector 2 is assignable
Vector2 &operator=(const Vector2 &) = default;
//! @brief A RAY Vector2 is cast-able in libray's Vector2
operator ::Vector2() const;
//! @brief A Vector 2 is assignable
Vector2 &operator=(const Vector2 &) = default;
//! @brief X value of vector
float x;
//! @brief Y value of vector
float y;
//! @brief X value of vector
float x;
//! @brief Y value of vector
float y;
INTERNAL:
//! @brief A RAY Vector2 is cast-able in libray's Vector2
operator ::Vector2() const;
};
}
+28 -25
View File
@@ -12,39 +12,42 @@
namespace RAY {
//! @brief A Three-dimensionnal Vector data type.
struct Vector3
class Vector3
{
//! @brief Vector 3 constructor
//! @param x x-value of vector, such as a width
//! @param y y-value of vector, such as a height
//! @param z z-value of vector, such as a depth
Vector3(float x, float y, float z);
public:
//! @brief Vector 3 constructor
//! @param x x-value of vector, such as a width
//! @param y y-value of vector, such as a height
//! @param z z-value of vector, such as a depth
Vector3(float x, float y, float z);
//! @brief Vector 3 constructor
//! @brief All values are set to zero
Vector3();
//! @brief Vector 3 constructor
//! @brief All values are set to zero
Vector3();
//! @brief A default Vector 3 copy-constructor
Vector3(const Vector3 &) = default;
//! @brief A default Vector 3 copy-constructor
Vector3(const Vector3 &) = default;
//! @brief A Vector 3 constructor from libray's vector3
Vector3(const ::Vector3 &);
//! @brief A Vector 3 constructor from libray's vector3
Vector3(const ::Vector3 &);
//! @brief A default Vector 3 destructor
~Vector3() = default;
//! @brief A default Vector 3 destructor
~Vector3() = default;
//! @brief A Vector 3 is assignable
Vector3 &operator=(const Vector3 &) = default;
//! @brief A Vector 3 is assignable
Vector3 &operator=(const Vector3 &) = default;
//! @brief A RAY Vector3 is cast-able in libray's Vector3
operator ::Vector3() const;
//! @brief X value of vector
float x;
//! @brief Y value of vector
float y;
//! @brief Z value of vector
float z;
//! @brief X value of vector
float x;
//! @brief Y value of vector
float y;
//! @brief Z value of vector
float z;
INTERNAL:
//! @brief A RAY Vector3 is cast-able in libray's Vector3
operator ::Vector3() const;
};
}