Hello Guest

Author Topic: Set platform per sprite collection  (Read 4664 times)

Dipso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Pure Fun Games
Set platform per sprite collection
« on: November 04, 2015, 07:40:45 am »
Hi

Is there a way to set the platform per sprite collection?

Example:
Before I load a scene which contain sprites from the collection "MyCollection", I call a method such as:
tk2dSystem.SetSpriteCollectionPlatform("MyCollection", "1x")


This would override the default platform (tk2dSystem.CurrentPlatform) when it loads the sprite collection.

This can be helpful when building for a mobile device that has low-memory, but high screen resolution, and you want to use smaller atlases for specific sprites (especially ones that won't appear blurry at hi-res).

Pure Fun Soccer brings arcade action to your iPhone, iPad and iPod touch.
Try out the free Lite version: https://itunes.apple.com/us/app/pure-fun-soccer-lite/id533048090?mt=8
Blog / Portfolio: http://www.diorgo.com/

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Set platform per sprite collection
« Reply #1 on: November 14, 2015, 09:32:22 am »
Hi,

There isn't a way to do this. However you do have the code and it is pretty straightforward to modify to do this if you want to. tk2dSpriteCollectionData.inst is where the choice happens - it just looks through all available collections to find the one that matches the current system platform, you just need to add whatever constraint you need on top of that.

Dipso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Pure Fun Games
Re: Set platform per sprite collection
« Reply #2 on: November 14, 2015, 01:44:35 pm »
Thanks for the feedback.
The code does seem straightforward to modify.

Pure Fun Soccer brings arcade action to your iPhone, iPad and iPod touch.
Try out the free Lite version: https://itunes.apple.com/us/app/pure-fun-soccer-lite/id533048090?mt=8
Blog / Portfolio: http://www.diorgo.com/