Auto-bind virtual method overrides
This commit is contained in:
committed by
Bastiaan Olij
parent
b3a4a2cf93
commit
a0634cca3f
@@ -36,9 +36,6 @@ void Example::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(ANSWER_TO_EVERYTHING);
|
||||
|
||||
BIND_CONSTANT(CONSTANT_WITHOUT_ENUM);
|
||||
|
||||
// Virtual function override.
|
||||
BIND_VIRTUAL_METHOD(_has_point);
|
||||
}
|
||||
|
||||
// Methods.
|
||||
@@ -83,7 +80,7 @@ Vector2 Example::get_custom_position() const {
|
||||
}
|
||||
|
||||
// Virtual function override.
|
||||
bool Example::_has_point(const Vector2 &point) {
|
||||
bool Example::_has_point(const Vector2 &point) const {
|
||||
Label *label = get_node<Label>("Label");
|
||||
label->set_text("Got point: " + Variant(point).stringify());
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
CONSTANT_WITHOUT_ENUM = 314,
|
||||
};
|
||||
|
||||
// Functions
|
||||
// Functions.
|
||||
void simple_func();
|
||||
void simple_const_func() const;
|
||||
String return_something(const String &base);
|
||||
@@ -37,12 +37,12 @@ public:
|
||||
Variant varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error);
|
||||
void emit_custom_signal(const String &name, int value);
|
||||
|
||||
// Property
|
||||
// Property.
|
||||
void set_custom_position(const Vector2 &pos);
|
||||
Vector2 get_custom_position() const;
|
||||
|
||||
// Virtual function override
|
||||
virtual bool _has_point(const Vector2 &point);
|
||||
// Virtual function override (no need to bind manually).
|
||||
virtual bool _has_point(const Vector2 &point) const override;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Example, Constants);
|
||||
|
||||
Reference in New Issue
Block a user