feat: GDENUM macro now uses uint32_t internally
parent
1cf0c55f2a
commit
308d073a93
|
@ -97,20 +97,23 @@
|
||||||
*/
|
*/
|
||||||
#define GDENUM(Name_, ...)\
|
#define GDENUM(Name_, ...)\
|
||||||
struct Name_ {\
|
struct Name_ {\
|
||||||
enum Value : int {__VA_ARGS__};\
|
public:\
|
||||||
private:\
|
enum Value : uint32_t {__VA_ARGS__};\
|
||||||
|
private:\
|
||||||
Value value{};\
|
Value value{};\
|
||||||
public:\
|
public:\
|
||||||
static inline godot::String get_property_hint() { return godot::String(#__VA_ARGS__); }\
|
static inline godot::String get_property_hint() { return godot::String(#__VA_ARGS__); }\
|
||||||
inline Name_(Value value) : value{value} {}\
|
inline Name_(Value value) : value{value} {}\
|
||||||
inline Name_(int value) : value{value} {}\
|
inline Name_(uint32_t value) : value{value} {}\
|
||||||
|
inline Name_(int value) : value{static_cast<uint32_t>(value)} {}\
|
||||||
inline Name_(Name_ const &value) : value{value.value} {}\
|
inline Name_(Name_ const &value) : value{value.value} {}\
|
||||||
inline bool operator==(Name_ const &rhs) const { return this->value == rhs.value; }\
|
inline bool operator==(Name_ const &rhs) const { return this->value == rhs.value; }\
|
||||||
inline bool operator==(Value const &rhs) const { return this->value == rhs; }\
|
inline bool operator==(Value const &rhs) const { return this->value == rhs; }\
|
||||||
inline bool operator!=(Name_ const &rhs) const { return this->value != rhs.value; }\
|
inline bool operator!=(Name_ const &rhs) const { return this->value != rhs.value; }\
|
||||||
inline bool operator!=(Value const &rhs) const { return this->value != rhs; }\
|
inline bool operator!=(Value const &rhs) const { return this->value != rhs; }\
|
||||||
inline operator Value() const { return this->value; }\
|
inline operator Value() const { return this->value; }\
|
||||||
inline operator int() const { return this->value; }\
|
inline operator uint32_t() const { return this->value; }\
|
||||||
|
inline operator int() const { return static_cast<int>(this->value); }\
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !UTILS_GODOT_MACROS_HPP
|
#endif // !UTILS_GODOT_MACROS_HPP
|
||||||
|
|
Loading…
Reference in New Issue