Game Development Reference
In-Depth Information
users with a native-looking user interface, which you can design efficiently with Inter-
face Builder and later skin with textures that maintain the game's look and feel so that
your user interface doesn't look like the Settings app. A great example of such a
skinned app is Carcassone—you have to look twice to see that its user interface is actu-
ally entirely made with UIKit views.
Although you can make reasonably good user interfaces with cocos2d, there's simply a
much greater variety of already existing controls available from UIKit that cocos2d
doesn't provide. Cocos2d provides CCMenu and that's about it in terms of user inter-
face controls. And the occasional reimplementation of popular UIKit views in cocos2d
always lacks in feel and features. Sliders, on/off toggle buttons, navigation views, and
tab bars can all be highly useful in designing your game's user interface, especially in
those games or parts of the game where performance is not of the utmost importance.
If you're a Cocoa Touch programmer and you need some multimedia content in your
game, it's much easier to rely on cocos2d to do that job and do it with high perform-
ance rather than programming it directly with OpenGL ES. After all, cocos2d shields
you from OpenGL ES and provides an interface that's much easier to use.
Cocoa Touch does provide powerful graphical frameworks like Core Graphics and
Core Animation. But they suffer from a major disadvantage: they're often not fast
enough for real-time games. They were designed to display and animate user interface
elements, not games.
Limitations of Mixing Cocoa Touch with cocos2d
When designing your app or game that mixes Cocoa Touch views with the cocos2d
view, you should be aware of some limitations. Most obviously, UIKit views aren't de-
signed for high performance, so you may notice a drop in performance, especially if
you use UIKit views in fast-paced games and during game play.
For example, it's more favorable for performance to rely on CCLabelBMFont to dis-
play the score during game play than using a UITextField for the same purpose. And
likewise, you should prefer to use CCMenu for the in-game pause menu button rather
than using a UIButton. In menu screens, though, those performance considerations are
usually not a problem, and you can see improved productivity from being able to use
Interface Builder to create your menu screens.
Search Nedrilad ::




Custom Search