Compare commits

..

No commits in common. "16b5de038df5660ea12f0ebdbbec75480598b126" and "08e21f0568fd4a230e46b5e1c9ab3ae48358f57c" have entirely different histories.

1 changed files with 5 additions and 12 deletions

View File

@ -73,8 +73,8 @@
* *
* Use when registering properties of arrays of resource classes. * Use when registering properties of arrays of resource classes.
*/ */
#define GDRESOURCETYPE(Class_) godot::vformat("%s/%s:%s", godot::Variant::OBJECT, godot::PROPERTY_HINT_RESOURCE_TYPE, Class_) #define GDRESOURCETYPE(Class_) godot::vformat("%s/%s:%s", godot::Variant::OBJECT, godot::PROPERTY_HINT_RESOURCE_TYPE, #Class_)
#define GDENUMTYPE(EnumString_) godot::vformat("%s/%s:%s", godot::Variant::INT, godot::PROPERTY_HINT_ENUM, EnumString_) #define GDENUMTYPE(EnumString_) godot::vformat("%s/%s:%s", godot::Variant::INT, godot::PROPERTY_HINT_ENUM, #EnumString_)
/*! \def GDEDITORONLY() /*! \def GDEDITORONLY()
* \brief Execute the rest of the function only if currently running as editor. * \brief Execute the rest of the function only if currently running as editor.
@ -96,20 +96,13 @@
*/ */
#define GDENUM(Name_, ...)\ #define GDENUM(Name_, ...)\
struct Name_ {\ struct Name_ {\
enum Value : int {__VA_ARGS__};\ enum Value {__VA_ARGS__};\
private:\ 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_(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==(Value const &rhs) const { return this->value == rhs; }\
inline bool operator!=(Name_ const &rhs) const { return this->value != rhs.value; }\
inline bool operator!=(Value const &rhs) const { return this->value != rhs; }\
inline operator Value() const { return this->value; }\
inline operator int() const { return this->value; }\
} }
#endif // !UTILS_GODOT_MACROS_HPP #endif // !UTILS_GODOT_MACROS_HPP