Hello Guest

Author Topic: how to dynamic load Textures to sprite collection  (Read 5536 times)

frozen

  • Newbie
  • *
  • Posts: 8
    • View Profile
how to dynamic load Textures to sprite collection
« on: July 03, 2014, 09:49:34 am »
Hello Unikron,

I need to load some textures which are runtime download from game server. so that I can change user's avatar or other specify elements.
There is my thought:
1. load textures to Texture2D format.
2. create or use a exist spriteCollection to place these texture2ds by order.
3. use the collection to game.

In tk2d's demo code runtimespritecollection. there is only way to load a texture and parsetext way to create a collecton. although it is a good solution, but still don't match my need..

After search some posts in forum.
such that http://2dtoolkit.com/forum/index.php?topic=1525.0
still have some confuse in flow and specific code.
Could you show me a whole steps and elegant way to finish this need? :'(

thank you very much.
« Last Edit: July 03, 2014, 09:51:38 am by frozen »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: how to dynamic load Textures to sprite collection
« Reply #1 on: July 03, 2014, 10:02:20 am »
2D Toolkit doesn't do runtime atlasing. You will need to build your runtime atlas yourself, possibly using Texture2D.PackTextures. After you have the atlas packed, you can create a sprite collection as shown in the runtime sprite collection samples.

frozen

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: how to dynamic load Textures to sprite collection
« Reply #2 on: July 03, 2014, 10:05:56 am »
ps:
I want to place texture into spriteCollection not one time but many different time
that is a additional operate to collection ,just like use editor way.

frozen

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: how to dynamic load Textures to sprite collection
« Reply #3 on: July 03, 2014, 10:06:59 am »
sorry for the last post. just see the respones now

frozen

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: how to dynamic load Textures to sprite collection
« Reply #4 on: July 03, 2014, 10:10:19 am »
Thanks for that answer. That show me a great way to solve my problem. Coding and trying