|
|
@@ -1,5 +1,4 @@
|
|
|
-#ifndef RMLUI_CONFIG_CONFIG_H
|
|
|
-#define RMLUI_CONFIG_CONFIG_H
|
|
|
+#pragma once
|
|
|
|
|
|
/*
|
|
|
* This file provides the means to configure various types used across RmlUi. It is possible to override container
|
|
|
@@ -36,7 +35,7 @@
|
|
|
namespace Rml {
|
|
|
|
|
|
// Default matrix type to be used. This alias may be set to ColumnMajorMatrix4f or RowMajorMatrix4f. This alias can not
|
|
|
- // be set here because matrix types are defined after this include in Core/Types.h.
|
|
|
+ // be set here because matrix types are defined after this include in Core/Types.h.
|
|
|
#ifdef RMLUI_MATRIX_ROW_MAJOR
|
|
|
#define RMLUI_MATRIX4_TYPE RowMajorMatrix4f
|
|
|
#else
|
|
|
@@ -133,58 +132,56 @@ inline UniquePtr<T> MakeUnique(Args&&... args)
|
|
|
|
|
|
} // namespace Rml
|
|
|
|
|
|
- /***
|
|
|
- // The following defines should be used for inserting custom type cast operators for conversion of RmlUi types
|
|
|
- // to user types. RmlUi uses template math types, therefore conversion operators to non-templated types
|
|
|
- // should be done using SFINAE as in example below.
|
|
|
-
|
|
|
- // Extra code to be inserted into RmlUi::Color<> class body. Note: be mindful of colorspaces used by different
|
|
|
- // color types. RmlUi assumes that float colors are interpreted in linear colorspace while byte colors are
|
|
|
- // interpreted as sRGB.
|
|
|
- #define RMLUI_COLOUR_USER_EXTRA \
|
|
|
- template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, byte>>* = nullptr> \
|
|
|
- operator MyColor() const { return MyColor( \
|
|
|
- (float)red / 255.0f, (float)green / 255.0f, (float)blue / 255.0f, (float)alpha / 255.0f); } \
|
|
|
- template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
- operator MyColor() const { return MyColor(red, green, blue, alpha); } \
|
|
|
-
|
|
|
- // Extra code to be inserted into RmlUi::Vector2<> class body.
|
|
|
- #define RMLUI_VECTOR2_USER_EXTRA \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
- operator typename MyIntVector2() const { return MyIntVector2(x, y); } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
- operator MyVector2() const { return MyVector2(x, y); } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
- Vector2(MyIntVector2 value) : Vector2(value.x_, value.y_) { } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
- Vector2(MyVector2 value) : Vector2(value.x_, value.y_) { } \
|
|
|
-
|
|
|
- // Extra code to be inserted into RmlUi::Vector3<> class body.
|
|
|
- #define RMLUI_VECTOR3_USER_EXTRA \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
- operator typename MyIntVector3() const { return MyIntVector3(x, y, z); } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
- operator MyVector3() const { return MyVector3(x, y, z); } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
- Vector3(MyIntVector3 value) : Vector3(value.x_, value.y_, value.z_) { } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
- Vector3(MyVector3 value) : Vector3(value.x_, value.y_, value.z_) { } \
|
|
|
-
|
|
|
- // Extra code to be inserted into RmlUi::Vector4<> class body.
|
|
|
- #define RMLUI_VECTOR4_USER_EXTRA \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
- operator typename MyIntVector4() const { return MyIntVector4(x, y, z, w); } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
- operator MyVector4() const { return MyVector4(x, y, z, w); } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
- Vector4(MyIntVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { } \
|
|
|
- template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
- Vector4(MyVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { } \
|
|
|
-
|
|
|
- // Extra code to be inserted into RmlUi::Matrix4<> class body.
|
|
|
- #define RMLUI_MATRIX4_USER_EXTRA operator MyMatrix4() const { return MyMatrix4(data()); }
|
|
|
- ***/
|
|
|
-
|
|
|
-#endif // RMLUI_USER_CONFIG_FILE
|
|
|
-
|
|
|
-#endif // RMLUI_CONFIG_CONFIG_H
|
|
|
+/***
|
|
|
+// The following defines should be used for inserting custom type cast operators for conversion of RmlUi types
|
|
|
+// to user types. RmlUi uses template math types, therefore conversion operators to non-templated types
|
|
|
+// should be done using SFINAE as in example below.
|
|
|
+
|
|
|
+// Extra code to be inserted into RmlUi::Color<> class body. Note: be mindful of colorspaces used by different
|
|
|
+// color types. RmlUi assumes that float colors are interpreted in linear colorspace while byte colors are
|
|
|
+// interpreted as sRGB.
|
|
|
+#define RMLUI_COLOUR_USER_EXTRA \
|
|
|
+ template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, byte>>* = nullptr> \
|
|
|
+ operator MyColor() const { return MyColor( \
|
|
|
+ (float)red / 255.0f, (float)green / 255.0f, (float)blue / 255.0f, (float)alpha / 255.0f); } \
|
|
|
+ template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
+ operator MyColor() const { return MyColor(red, green, blue, alpha); } \
|
|
|
+
|
|
|
+// Extra code to be inserted into RmlUi::Vector2<> class body.
|
|
|
+#define RMLUI_VECTOR2_USER_EXTRA \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
+ operator typename MyIntVector2() const { return MyIntVector2(x, y); } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
+ operator MyVector2() const { return MyVector2(x, y); } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
+ Vector2(MyIntVector2 value) : Vector2(value.x_, value.y_) { } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
+ Vector2(MyVector2 value) : Vector2(value.x_, value.y_) { } \
|
|
|
+
|
|
|
+// Extra code to be inserted into RmlUi::Vector3<> class body.
|
|
|
+#define RMLUI_VECTOR3_USER_EXTRA \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
+ operator typename MyIntVector3() const { return MyIntVector3(x, y, z); } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
+ operator MyVector3() const { return MyVector3(x, y, z); } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
+ Vector3(MyIntVector3 value) : Vector3(value.x_, value.y_, value.z_) { } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
+ Vector3(MyVector3 value) : Vector3(value.x_, value.y_, value.z_) { } \
|
|
|
+
|
|
|
+// Extra code to be inserted into RmlUi::Vector4<> class body.
|
|
|
+#define RMLUI_VECTOR4_USER_EXTRA \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
+ operator typename MyIntVector4() const { return MyIntVector4(x, y, z, w); } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
+ operator MyVector4() const { return MyVector4(x, y, z, w); } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr> \
|
|
|
+ Vector4(MyIntVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { } \
|
|
|
+ template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr> \
|
|
|
+ Vector4(MyVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { } \
|
|
|
+
|
|
|
+// Extra code to be inserted into RmlUi::Matrix4<> class body.
|
|
|
+ #define RMLUI_MATRIX4_USER_EXTRA operator MyMatrix4() const { return MyMatrix4(data()); }
|
|
|
+***/
|
|
|
+
|
|
|
+#endif
|