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

Feature idea: Sprite.localToWorld and .worldToLocal #11

Open
JoeStrout opened this issue Nov 1, 2023 · 0 comments
Open

Feature idea: Sprite.localToWorld and .worldToLocal #11

JoeStrout opened this issue Nov 1, 2023 · 0 comments

Comments

@JoeStrout
Copy link
Owner

Sprites already have the concept of "local" and "world" coordinates, embodied in their localBounds and worldBounds properties.

But sometimes (as in #10), it's handy to convert between these coordinate systems. It might be nice to have localToWorld and worldToLocal methods that do this, taking into account scaling, rotation, and position in the same way that worldBounds does.

This would make it easier to figure out the sprite image pixel under a screen point, though that still will require a bit of math since images are centered on local 0,0.

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

No branches or pull requests

1 participant