2D Toolkit Forum

2D Toolkit => Support => Topic started by: drkucho on January 20, 2015, 09:18:24 pm

Title: Reading Sprite Pixels from tk2d Generated Atlas
Post by: drkucho on January 20, 2015, 09:18:24 pm
how can i do this ? i need the coordinates / bounds data from each sprite inside atlas, i am doing my tests using the tk2dCollectionData properties but no luck, i have tried regionX, regionY, regionW and regionH but these seems to be the coordinates for the sprite sheet :-(
Title: Re: Reading Sprite Pixels from tk2d Generated Atlas
Post by: unikronsoftware on January 20, 2015, 09:48:52 pm
http://2dtoolkit.com/forum/index.php/topic,4146.msg19547.html#msg19547

Its not directly exposed because a sprite could be non-rectangular, etc. We don't store a rect but you can guess from teh geometry as described above.
Title: Re: Reading Sprite Pixels from tk2d Generated Atlas
Post by: drkucho on January 20, 2015, 10:23:44 pm
sorry but i don't understand? ... tk2dSpriteGeomGen.SetClippedSpriteGeom ...? what is / where is that? can't find a single result searching for that
Title: Re: Reading Sprite Pixels from tk2d Generated Atlas
Post by: unikronsoftware on January 20, 2015, 10:33:10 pm
Look for SetClippedSpriteGeom, its in the  tk2dSpriteGeomGen class.
Title: Re: Reading Sprite Pixels from tk2d Generated Atlas
Post by: drkucho on January 20, 2015, 10:41:04 pm
sorry can't find it  :(

http://www.unikronsoftware.com/2dtoolkit/docs/latest/html/annotated.html

where is it?
Title: Re: Reading Sprite Pixels from tk2d Generated Atlas
Post by: drkucho on January 20, 2015, 10:45:30 pm
aaah you mean inside the coooode!! , alright i found something but not sure im gonna understand it , so there are no variables/proerties i can read to know where the sprite is it?
Title: Re: Reading Sprite Pixels from tk2d Generated Atlas
Post by: unikronsoftware on January 21, 2015, 12:04:57 am
Nope, the only thing that gets stored is the sprite geometry, and that can be non-rectangular and span multiple areas of the atlas (eg. sprite dicing). Its meaningless to have a texture rect in the general context of tk2d.
Title: Re: Reading Sprite Pixels from tk2d Generated Atlas
Post by: drkucho on January 21, 2015, 12:37:17 am
i see, and makes sense, ill use regular unity sprites for this specific thing, thanks for clarification