0

I am needing to run through a series of full screen PNGs and I am wondering which would be more optimized out of using UIImageView animations or Cocos2d animations (I can't use a sprite sheet in Cocos2d because the PNGs are to large) So just running single PNGs through an animation which would be a better choice?

Stephen
  • 499
  • 9
  • 28

1 Answers1

1

try using a .pvr.ccz format (instead of PNG), especially in the context of running an animation while loading frame by frame. That format's load performance is the best, AFAI know (have measured). Also, it will tend to thin-out your app's bundle size.

if you use TexturePacker, you will be able to do this handily, with NPOT textures (good for 'in core' memory consumption).

YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48
  • I thought texture packer is only for sprite sheets. How can I save individual images as .pvr.ccz formats? – Stephen Apr 12 '13 at 18:20
  • 1
    do a sprite sheet with one texture, and save as ... i guess, discarding the .plist. There must be a smarter way to do it with TP, but i'm not usually at the helm :) – YvesLeBorg Apr 12 '13 at 18:25
  • So can I load the .pvr.ccz file the same way that I would load a PNG – Stephen Apr 12 '13 at 18:30
  • yes, with cocos2d i am certain of it. [CCSprite spriteWithFile:fileName] does all the work for you. Same as for your .png's, omit the -hd -this and -that suffixes from this call's fileName, and cocos will resolve the appropriate .pvr.ccz texture from the ones you have added to your project. – YvesLeBorg Apr 12 '13 at 18:33
  • yep, i just tried a 'one texture' sprite sheet. works, TP publishes the .pvr.ccz. – YvesLeBorg Apr 12 '13 at 18:35
  • yes (which i could repeat 4 times in order to get 12 characters in this window), but yes still. – YvesLeBorg Apr 12 '13 at 19:43
  • I would suggest a different approach. Decode the image data to raw BGRA pixels before hand and then blit the graphics data directly into memory from mmap() memory. This works with with OpenGL/cocos2d and CoreGraphics and it is very low level and very fast but it does not use up all the app memory. See more info in my answer to this question http://stackoverflow.com/questions/8112698/how-to-do-animations-using-images-efficiently-in-ios/17129053#17129053 – MoDJ Nov 28 '14 at 09:44