Game Development Reference
In-Depth Information
Caution If you enable Retina display support, you should supply HD images
for all your sprites, bitmap fonts, particle effects, and so on. If you don't, the
resulting effect will be that your app looks normal on SD devices, but all the
visuals that don't have an HD version will be drawn in half the size on Retina
displays. Always test your app on standard and Retina resolution devices. If
you don't have both, you can also change the iOS Simulator via Hardware
Device to emulate a Retina device. Note that iOS Simulator set to emulate a
Retina device runs a lot slower than usual. And the iPad Retina Simulator may
even be unplayable if the 2048x1536 window doesn't fit entirely on your
screen.
CCSpriteBatchNode
Every time a texture is drawn on the screen, the graphics hardware has to prepare the
rendering, render the graphics, and clean up after rendering. There's an inherent over-
head caused by starting and ending the rendering of a single texture. You can alleviate
it by letting the graphics hardware know that you have a group of sprites that should be
rendered using the same texture. In that case, the graphics hardware will perform the
preparation and cleanup steps only once for a group of sprites.
Figure 6-2 shows an example of this kind of batch rendering. You can see the hundreds
of identical bullets on the screen. If you rendered them each one at a time, your framer-
ate would drop by at least 15 percent in this case, and by a lot more if the bullet texture
were larger and the sprites were rotated and scaled. With a CCSpriteBatchNode ,
you can keep your app running at top speed. To test the effect of sprite batching, try out
the Kobold2D template project named Sprite-Performance and read my blog post about
sprite batch performance here: www.learn-cocos2d.com/2011/09/
cocos2d-spritebatch-performance-test .
 
Search Nedrilad ::




Custom Search