diff options
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/example.cpp | 18 | ||||
-rw-r--r-- | test/src/example.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/src/example.cpp b/test/src/example.cpp index 09258f4..890319d 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -103,6 +103,8 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("extended_ref_checks"), &Example::extended_ref_checks); ClassDB::bind_method(D_METHOD("test_array"), &Example::test_array); + ClassDB::bind_method(D_METHOD("test_tarray_arg", "array"), &Example::test_tarray_arg); + ClassDB::bind_method(D_METHOD("test_tarray"), &Example::test_tarray); ClassDB::bind_method(D_METHOD("test_dictionary"), &Example::test_dictionary); ClassDB::bind_method(D_METHOD("def_args", "a", "b"), &Example::def_args, DEFVAL(100), DEFVAL(200)); @@ -223,6 +225,22 @@ Array Example::test_array() const { return arr; } +void Example::test_tarray_arg(const TypedArray<int64_t> &p_array) { + for (int i = 0; i < p_array.size(); i++) { + UtilityFunctions::print(p_array[i]); + } +} + +TypedArray<Vector2> Example::test_tarray() const { + TypedArray<Vector2> arr; + + arr.resize(2); + arr[0] = Vector2(1, 2); + arr[1] = Vector2(2, 3); + + return arr; +} + Dictionary Example::test_dictionary() const { Dictionary dict; diff --git a/test/src/example.h b/test/src/example.h index 5cc32a6..e9565f9 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -88,6 +88,8 @@ public: int def_args(int p_a = 100, int p_b = 200); Array test_array() const; + void test_tarray_arg(const TypedArray<int64_t> &p_array); + TypedArray<Vector2> test_tarray() const; Dictionary test_dictionary() const; // Property. |