summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-05-13 14:48:16 +0200
committerGitHub <noreply@github.com>2021-05-13 14:48:16 +0200
commita3dd18b12e13938492e571cfabf0ec514bf97c75 (patch)
tree4ff9e9777a1e72f8a4f65c8e432e8d50c1a9c354 /scene/2d
parentd0c2ac8a0edefaed11c9307fe5054b5bc9482f8b (diff)
parent75e3f6b732005ba3a2499656e3623f5716beaa6b (diff)
Merge pull request #39976 from aaronfranke/tilemap-vec2i
Update TileMap to use Vector2i
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/tile_map.cpp6
-rw-r--r--scene/2d/tile_map.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 4400198497..0afead0863 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -902,7 +902,7 @@ void TileMap::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(p);
}
-Vector2 TileMap::map_to_world(const Vector2 &p_pos) const {
+Vector2 TileMap::map_to_world(const Vector2i &p_pos) const {
// SHOULD RETURN THE CENTER OF THE TILE
ERR_FAIL_COND_V(!tile_set.is_valid(), Vector2());
@@ -980,7 +980,7 @@ Vector2 TileMap::map_to_world(const Vector2 &p_pos) const {
}
Vector2i TileMap::world_to_map(const Vector2 &p_pos) const {
- ERR_FAIL_COND_V(!tile_set.is_valid(), Vector2());
+ ERR_FAIL_COND_V(!tile_set.is_valid(), Vector2i());
Vector2 ret = p_pos;
ret /= tile_set->get_tile_size();
@@ -1143,7 +1143,7 @@ Vector2i TileMap::world_to_map(const Vector2 &p_pos) const {
} else {
ret = (ret + Vector2(0.00005, 0.00005)).floor();
}
- return ret;
+ return Vector2i(ret);
}
bool TileMap::is_existing_neighbor(TileSet::CellNeighbor p_cell_neighbor) const {
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index 704897da15..e9dbccbdb9 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -264,7 +264,7 @@ public:
void update_dirty_quadrants();
- Vector2 map_to_world(const Vector2 &p_pos) const;
+ Vector2 map_to_world(const Vector2i &p_pos) const;
Vector2i world_to_map(const Vector2 &p_pos) const;
bool is_existing_neighbor(TileSet::CellNeighbor p_cell_neighbor) const;