summaryrefslogtreecommitdiff
path: root/core/variant/variant.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant/variant.h')
-rw-r--r--core/variant/variant.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h
index 8ce5e7dcd2..230ed33c0c 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -31,6 +31,7 @@
#ifndef VARIANT_H
#define VARIANT_H
+#include "core/input/input_enums.h"
#include "core/io/ip_address.h"
#include "core/math/aabb.h"
#include "core/math/basis.h"
@@ -43,6 +44,7 @@
#include "core/math/vector3.h"
#include "core/math/vector3i.h"
#include "core/object/object_id.h"
+#include "core/os/keyboard.h"
#include "core/string/node_path.h"
#include "core/string/ustring.h"
#include "core/templates/rid.h"
@@ -430,6 +432,21 @@ public:
Variant(const IPAddress &p_address);
+#define VARIANT_ENUM_CLASS_CONSTRUCTOR(m_enum) \
+ Variant(const m_enum &p_value) { \
+ type = INT; \
+ _data._int = (int64_t)p_value; \
+ }
+
+ // Only enum classes that need to be bound need this to be defined.
+ VARIANT_ENUM_CLASS_CONSTRUCTOR(JoyAxis)
+ VARIANT_ENUM_CLASS_CONSTRUCTOR(JoyButton)
+ VARIANT_ENUM_CLASS_CONSTRUCTOR(Key)
+ VARIANT_ENUM_CLASS_CONSTRUCTOR(MIDIMessage)
+ VARIANT_ENUM_CLASS_CONSTRUCTOR(MouseButton)
+
+#undef VARIANT_ENUM_CLASS_CONSTRUCTOR
+
// If this changes the table in variant_op must be updated
enum Operator {
//comparison