diff options
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r-- | scene/2d/tile_map.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 18f8b5bbbb..bc2dfe1013 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1024,6 +1024,19 @@ bool TileMap::is_y_sort_mode_enabled() const { return y_sort_mode; } +Array TileMap::get_used_cells() const { + + Array 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); + a[i++]=p; + } + + return a; +} void TileMap::_bind_methods() { @@ -1080,6 +1093,8 @@ void TileMap::_bind_methods() { ObjectTypeDB::bind_method(_MD("clear"),&TileMap::clear); + ObjectTypeDB::bind_method(_MD("get_used_cells"),&TileMap::get_used_cells); + ObjectTypeDB::bind_method(_MD("map_to_world","mappos","ignore_half_ofs"),&TileMap::map_to_world,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("world_to_map","worldpos"),&TileMap::world_to_map); |