tetra
tetra copied to clipboard
Horizontal and vertical flip
Summary: Add booleans for horizontal and vertical flip to DrawParams, that does not offset the textures. This would be nice because scaling in negative direction also offsets the texture in the negative direction. As a workaround to avoid this, we need to add half texture size to position and to origin.
Steps to reproduce:
DrawParams::default()
.position(some_position)
.scale(Vec2::new(-1.0, -1.0))
Texture now moved up and to the left.
Expected behavior: Expected the texture to draw at some_position, just mirrored.
Additional info:
This definitely does seem like something worth adding (XNA has it via SpriteEffects
). I'd just need to figure out if there's a way to do it without a breaking change - because DrawParams
has pub
fields and no non_exhaustive
annotation, it could break people's code if I added a new field (but it might be minor enough to be worth it).