diff options
author | Ranoller <davarrcal@hotmail.com> | 2019-06-05 23:23:36 +0200 |
---|---|---|
committer | Ranoller <davarrcal@hotmail.com> | 2019-06-05 23:23:36 +0200 |
commit | f26e9daab53da723a8fb0306b72781c492a5c83c (patch) | |
tree | ae7166dc09711875062c7d246030e9e089e5d810 /scene/2d | |
parent | 197b65f32ac811f79bc5599fbfe8cf83914b6873 (diff) |
Make tilemap texture origin point top-left.
Fix https://github.com/godotengine/godot/issues/29487. In this commit: https://github.com/godotengine/godot/pull/28896 bad offset of textures and shapes was fixed, but a center of texture was added too, and this seems not dessired by default because breaks too much compatibility with demos and user projects. A future Check box for center texture can be added
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/tile_map.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 2b43861eea..b3b6f3175d 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -220,8 +220,8 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const xform.elements[1].y = -xform.elements[1].y; offset.y = s.y - offset.y; } - - offset += cell_size / 2 - s / 2; + /* For a future CheckBox to Center Texture: + offset += cell_size / 2 - s / 2; */ xform.elements[2] += offset; } @@ -372,10 +372,11 @@ void TileMap::update_dirty_quadrants() { if (c.transpose) { SWAP(tile_ofs.x, tile_ofs.y); + /* For a future CheckBox to Center Texture: rect.position.x += cell_size.x / 2 - rect.size.y / 2; rect.position.y += cell_size.y / 2 - rect.size.x / 2; } else { - rect.position += cell_size / 2 - rect.size / 2; + rect.position += cell_size / 2 - rect.size / 2; */ } if (c.flip_h) { |