Hello Guest

Author Topic: Reading Sprite Pixels from tk2d Generated Atlas  (Read 5106 times)

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Reading Sprite Pixels from tk2d Generated Atlas
« 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 :-(

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Reading Sprite Pixels from tk2d Generated Atlas
« Reply #1 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.

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Reading Sprite Pixels from tk2d Generated Atlas
« Reply #2 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Reading Sprite Pixels from tk2d Generated Atlas
« Reply #3 on: January 20, 2015, 10:33:10 pm »
Look for SetClippedSpriteGeom, its in the  tk2dSpriteGeomGen class.

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Reading Sprite Pixels from tk2d Generated Atlas
« Reply #4 on: January 20, 2015, 10:41:04 pm »

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Reading Sprite Pixels from tk2d Generated Atlas
« Reply #5 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?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Reading Sprite Pixels from tk2d Generated Atlas
« Reply #6 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.

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Reading Sprite Pixels from tk2d Generated Atlas
« Reply #7 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