Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Ability to calculate the tile on-screen position #70

Open
chayleaf opened this issue Dec 27, 2020 · 4 comments
Open

Ability to calculate the tile on-screen position #70

chayleaf opened this issue Dec 27, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@chayleaf
Copy link

chayleaf commented Dec 27, 2020

What problem does this solve or what need does it fill?

Right now, the crate forces you to let it render all of the objects on the tilemap itself. However, this isn't flexible - for example, currently animations aren't supported. There needs to be an ability to render parts of it yourself (sorry if such a solution is in the crate already, I couldn't find it). There's also a much more fundamental issue - not knowing the tile coordinates makes you unable to react to mouse clicks properly

Describe the solution would you like?

An API for getting tile positions, similar to the vertex shaders but in rust.

Describe the alternative(s) you've considered?

Adding all of the features users would possibly want to the Tile struct, possibly bloating it.

@chayleaf chayleaf added the enhancement New feature or request label Dec 27, 2020
@joshuajbouw
Copy link
Owner

Need to double check, but I think I added API in one of my local branches that gets the tile coordinate from a global coordinate.

@chayleaf
Copy link
Author

Actually the tile module's description details the perfect solution - "Tile traits to implement for a custom tile". However, currently the module only has a struct, no traits.

@joshuajbouw
Copy link
Owner

Once upon at time, it had it in the 0.1 release. Took it out for now as it was a bit.. tedious to work with. Will eventually bring it back.

@joshuajbouw
Copy link
Owner

Ok so, I got the code for this in #94, sort of. It is not exactly straight forward. You need to feed it both the transform of what you want and then the transform of the tilemap.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants