Use "enum class" for input enums

This commit is contained in:
Aaron Franke 2021-08-13 16:31:57 -05:00
parent 4f85cad013
commit 3c0fdcc8ac
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
154 changed files with 3482 additions and 3392 deletions

View file

@ -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