Skip to content

Conversation

@mariovisic
Copy link
Contributor

@mariovisic mariovisic commented Aug 27, 2021

Previously: to scale the size of tiles displayed in a tileset, you would need
to multiply the tile width/height, the image width/height as well as the
spacing and padding values by the scale. This works but means that you need to
know the dimensions of the tileset image, rather than having it be detected and
you have to multiply each value which can be confusing.

This patch still allows you to manually set those values if you wish but
introduces a 'scale' attribute which will do the work for you, meaning now you
can set a scale without having to specify the width/height of the tileset image
manually and multiply all attributes.

This patch also fixes a bug where the spacing was not being calculated
correctly, it was using (tile_x + spacing) * tile_width which is incorrect,
it is now: tile_x * (spacing + tile_width)

@mariovisic mariovisic requested a review from blacktm August 27, 2021 01:58
@mariovisic
Copy link
Contributor Author

It would have been good to be able to get Vertices do the scaling instead of Tileset but that would mean that Vertices would be aware of tileset spacing and padding, so there's not an easy clear seperation that I can think of.

Previously: to scale the size of tiles displayed in a tileset, you would need
to multiply the tile width/height, the image width/height as well as the
spacing and padding values by the scale. This works but means that you need to
know the dimensions of the tileset image, rather than having it be detected and
you have to multiply each value which can be confusing.

This patch still allows you to manually set those values if you wish but
introduces a 'scale' attribute which will do the work for you, meaning now you
can set a scale without having to specify the width/height of the tileset image
manually and multiply all attributes.

This patch also fixes a bug where the spacing was not being calculated
correctly, it was using `(tile_x + spacing) * tile_width` which is incorrect,
it is now: `tile_x * (spacing + tile_width)`
@mariovisic mariovisic merged commit 117f250 into main Aug 27, 2021
@mariovisic mariovisic deleted the tileset_scaling branch August 27, 2021 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants