summaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-05-23 15:17:06 -0500
committerDavid Snopek <dsnopek@gmail.com>2023-06-07 08:30:33 -0500
commitad726015e7bb5aaaf6d8f3b98fca2b21bf15c830 (patch)
treea0c4580f96da160e27bfd694f2dee8614927db87 /test/src
parentc669f0b78a1a046dd2f7c2589b27abd28ab13101 (diff)
downloadredot-cpp-ad726015e7bb5aaaf6d8f3b98fca2b21bf15c830.tar.gz
Revert the changes from PR #1044 and #1045 and standardize on `Object **` encoding in ptrcall
Diffstat (limited to 'test/src')
-rw-r--r--test/src/example.cpp7
-rw-r--r--test/src/example.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/test/src/example.cpp b/test/src/example.cpp
index 6d24379..e605a45 100644
--- a/test/src/example.cpp
+++ b/test/src/example.cpp
@@ -348,3 +348,10 @@ bool Example::_has_point(const Vector2 &point) const {
return false;
}
+
+void Example::_input(const Ref<InputEvent> &event) {
+ const InputEventKey *key_event = Object::cast_to<const InputEventKey>(*event);
+ if (key_event) {
+ emit_custom_signal(String("_input: ") + key_event->get_key_label(), key_event->get_unicode());
+ }
+}
diff --git a/test/src/example.h b/test/src/example.h
index ebf9156..8c8b250 100644
--- a/test/src/example.h
+++ b/test/src/example.h
@@ -17,6 +17,7 @@
#include <godot_cpp/classes/control.hpp>
#include <godot_cpp/classes/global_constants.hpp>
#include <godot_cpp/classes/image.hpp>
+#include <godot_cpp/classes/input_event_key.hpp>
#include <godot_cpp/classes/viewport.hpp>
#include <godot_cpp/core/binder_common.hpp>
@@ -129,6 +130,7 @@ 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;
};
VARIANT_ENUM_CAST(Example::Constants);