feat: added more macros
This commit is contained in:
parent
375ef84c5f
commit
186bf304de
1 changed files with 34 additions and 0 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef GODOT_EXTRA_MACROS_H
|
||||
#define GODOT_EXTRA_MACROS_H
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
#define BIND_GET_SET(m_property) \
|
||||
ClassDB::bind_method(D_METHOD("set_" #m_property, #m_property), \
|
||||
&self_type::set_##m_property); \
|
||||
|
|
@ -17,4 +19,36 @@
|
|||
ADD_PROPERTY(PropertyInfo(m_type, #m_property), "set_" #m_property, \
|
||||
"get_" #m_property)
|
||||
|
||||
#define GET_SET_FNS(m_type, m_property) \
|
||||
m_type get_##m_property() const { \
|
||||
return this->m_property; \
|
||||
} \
|
||||
void set_##m_property(m_type value) { \
|
||||
this->m_property = value; \
|
||||
}
|
||||
#define GET_SET_REF_FNS(m_type, m_property) \
|
||||
m_type &get_##m_property() { \
|
||||
return this->m_property; \
|
||||
} \
|
||||
void set_##m_property(m_type &value) { \
|
||||
this->m_property = value; \
|
||||
}
|
||||
|
||||
#define GET_SET_FNS_EX(m_type, m_property, m_ex) \
|
||||
m_type get_##m_property() const { \
|
||||
return this->m_property; \
|
||||
} \
|
||||
void set_##m_property(m_type value) { \
|
||||
m_ex; \
|
||||
this->m_property = value; \
|
||||
}
|
||||
|
||||
#define __VA_ARGS__STRING(...) String(#__VA_ARGS__)
|
||||
|
||||
#define GDENUM(M_Name, ...) \
|
||||
enum M_Name { __VA_ARGS__ }; \
|
||||
static String M_Name##_hint() { \
|
||||
return __VA_ARGS__STRING(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
#endif // !GODOT_EXTRA_MACROS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue