diff options
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/example.cpp | 11 | ||||
-rw-r--r-- | test/src/example.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/test/src/example.cpp b/test/src/example.cpp index 5372d70..53d11f4 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -230,6 +230,9 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("callable_bind"), &Example::callable_bind); ClassDB::bind_method(D_METHOD("test_post_initialize"), &Example::test_post_initialize); + GDVIRTUAL_BIND(_do_something_virtual, "name", "value"); + ClassDB::bind_method(D_METHOD("test_virtual_implemented_in_script"), &Example::test_virtual_implemented_in_script); + ClassDB::bind_static_method("Example", D_METHOD("test_static", "a", "b"), &Example::test_static); ClassDB::bind_static_method("Example", D_METHOD("test_static2"), &Example::test_static2); @@ -626,3 +629,11 @@ void Example::_input(const Ref<InputEvent> &event) { emit_custom_signal(String("_input: ") + key_event->get_key_label(), key_event->get_unicode()); } } + +String Example::test_virtual_implemented_in_script(const String &p_name, int p_value) { + String ret; + if (GDVIRTUAL_CALL(_do_something_virtual, p_name, p_value, ret)) { + return ret; + } + return "Unimplemented"; +} diff --git a/test/src/example.h b/test/src/example.h index c86a51f..1c57720 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -24,6 +24,7 @@ #include <godot_cpp/variant/variant.hpp> #include <godot_cpp/core/binder_common.hpp> +#include <godot_cpp/core/gdvirtual.gen.inc> using namespace godot; @@ -181,6 +182,9 @@ public: // Virtual function override (no need to bind manually). virtual bool _has_point(const Vector2 &point) const override; virtual void _input(const Ref<InputEvent> &event) override; + + GDVIRTUAL2R(String, _do_something_virtual, String, int); + String test_virtual_implemented_in_script(const String &p_name, int p_value); }; VARIANT_ENUM_CAST(Example::Constants); |