From 308d073a93db141018746c9a0dfc3abbf274bdfc Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 9 Aug 2024 19:43:55 +0200 Subject: [PATCH] feat: GDENUM macro now uses uint32_t internally --- godot_macros.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/godot_macros.hpp b/godot_macros.hpp index 55cf577..d4b82ff 100644 --- a/godot_macros.hpp +++ b/godot_macros.hpp @@ -97,20 +97,23 @@ */ #define GDENUM(Name_, ...)\ struct Name_ {\ - enum Value : int {__VA_ARGS__};\ - private:\ +public:\ + enum Value : uint32_t {__VA_ARGS__};\ +private:\ Value value{};\ - public:\ +public:\ static inline godot::String get_property_hint() { return godot::String(#__VA_ARGS__); }\ 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(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; }\ + inline operator uint32_t() const { return this->value; }\ + inline operator int() const { return static_cast(this->value); }\ } #endif // !UTILS_GODOT_MACROS_HPP