diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-23 09:19:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-23 09:19:37 +0200 |
commit | e40aa112ee8e784f21c86083095b391672c709b6 (patch) | |
tree | 6dc49d29ada00ecae5b964a3d9de27045ba732a5 /test/src/example.cpp | |
parent | 86703055894cb2555f0ec704eff11e3c1c81a5d3 (diff) | |
parent | c001d0e5c7cb4651196d63bc5a385dad5509c827 (diff) | |
download | redot-cpp-e40aa112ee8e784f21c86083095b391672c709b6.tar.gz |
Merge pull request #841 from bruvzg/typed_array
Implement support for typed arrays.
Diffstat (limited to 'test/src/example.cpp')
-rw-r--r-- | test/src/example.cpp | 18 |
1 files changed, 18 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; |