2D Toolkit Forum
2D Toolkit => Support => Topic started by: mythgarr on July 12, 2013, 10:32:36 pm
-
I need to be able to get a reference to the Texture and Source Rectangle for a given sprite. I've poked around in the source code for a while now trying to figure out some way to do this without success. I understand that trimmed sprites would cause some trouble with this approach - if I disable trimming is there any way to get what I need?
-
The source rectangle in the texture? Remember sprites can be rotated, and also flipped - also you won't be able to use dicing, custom geometry, etc. if you want to do this.
You can find the 4 points / uvs for your sprite as described in SetClippedSpriteGeom. You can map UVs -> x & y by multiplying by texture width and height.