feat: added more functions to GDENUM class
This commit is contained in:
		
							parent
							
								
									08e21f0568
								
							
						
					
					
						commit
						8b670b309e
					
				| 
						 | 
					@ -96,13 +96,20 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define GDENUM(Name_, ...)\
 | 
					#define GDENUM(Name_, ...)\
 | 
				
			||||||
struct Name_ {\
 | 
					struct Name_ {\
 | 
				
			||||||
    enum Value {__VA_ARGS__};\
 | 
					    enum Value : int {__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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue