diff options
author | Juan Linietsky <reduzio@gmail.com> | 2020-04-20 19:06:00 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-04-21 10:15:40 +0200 |
commit | 5d4dc2d45caef77cdb52e365bc02f64d54046df5 (patch) | |
tree | fb09d0a007a7a4fb4c45826e0e5955da4a11a07c /scene/2d | |
parent | 7343ec13d9d32cedb2511db0ab5d1ed454404d65 (diff) |
Add ability to bind typed arrays to script API
Note: Only replaced 2 instances to test, Node.get_children and TileMap.get_used_cells
Note: Will do a mass replace on later PRs of whathever I can find, but probably need
a tool to grep through doc.
Warning: Mono will break, needs to be fixed (and so do TypeScript and NativeScript, need to ask respective maintainers)
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/tile_map.cpp | 6 | ||||
-rw-r--r-- | scene/2d/tile_map.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 1cf12e4421..14a4d24b44 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1691,14 +1691,14 @@ bool TileMap::is_centered_textures_enabled() const { return centered_textures; } -Array TileMap::get_used_cells() const { +TypedArray<Vector2i> TileMap::get_used_cells() const { - Array a; + TypedArray<Vector2i> a; a.resize(tile_map.size()); int i = 0; for (Map<PosKey, Cell>::Element *E = tile_map.front(); E; E = E->next()) { - Vector2 p(E->key().x, E->key().y); + Vector2i p(E->key().x, E->key().y); a[i++] = p; } diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index d9490aae13..cc44bc147b 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -328,7 +328,7 @@ public: void set_centered_textures(bool p_enable); bool is_centered_textures_enabled() const; - Array get_used_cells() const; + TypedArray<Vector2i> get_used_cells() const; Array get_used_cells_by_id(int p_id) const; Rect2 get_used_rect(); // Not const because of cache |