Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix tile flips when using canvas.drawAtlas #1610

Merged
merged 6 commits into from
May 8, 2022

Conversation

nathanaelneveux
Copy link
Contributor

Description

This PR makes changes to SpriteBatch to deal with flipped tiles. Specifically since RSTransform and therefore drawAtlas isn't able to handle flips this PR feeds an additional flipped version of the atlas to the SpriteBatch. Since this could create an additional image per flip type (H + V), flips have been simplified to reduce that to just a horizontally flipped image. All vertical flips (+rotations) can be represented as horizontal flips +180º.

The SimpleFlips class has been updated to represent this even simpler representation of angles and flips. This is the only breaking change in this PR.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples.

Breaking Change

  • Yes, this contains a breaking change.
  • No, this is not a breaking change.

Related Issues

Fixes issue listed at top of package README

Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Have you seen that there is a merge conflict?

packages/flame_tiled/lib/src/renderable_tile_map.dart Outdated Show resolved Hide resolved
packages/flame_tiled/lib/src/simple_flips.dart Outdated Show resolved Hide resolved
@spydon spydon changed the title fix: flame_tIled Fix Tile flips when using canvas.drawAtlas fix: Fix tile flips when using canvas.drawAtlas May 7, 2022
Copy link
Member

@luanpotter luanpotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@spydon spydon enabled auto-merge (squash) May 8, 2022 15:42
@spydon spydon merged commit b4ad498 into flame-engine:main May 8, 2022
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.

3 participants