Download at WoweBook.Com
iPhone Game Development
Paul Zirkle and Joe Hogue
Beijing
•
Cambridge
•
Farnham
•
Köln
•
Sebastopol
•
Taipei
•
Tokyo
Download at WoweBook.Com
iPhone Game Development
by Paul Zirkle and Joe Hogue
Copyright © 2010 Paul Zirkle and Joe Hogue. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly
books
may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editor: Andy Oram
Production Editor: Loranah Dimant
Copyeditor: Audrey Doyle
Proofreader: Loranah Dimant
Indexer: Lucie Haskins
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Robert Romano
Printing History:
November 2009:
First Edition.
Nutshell
Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. iPhone Game Development, the image of a roadrunner, and related trade dress are
trademarks of O’Reilly Media, Inc.
Many of
the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-0-596-15985-6
[M]
1256658809
Download at WoweBook.Com
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1.
Introduction to the iPhone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Apple Developer Account and Downloading the SDK 1
Application Bundles 2
Xcode and Interface Builder 4
Views and Controllers 13
Loading Devices 22
Certificates and Profiles 22
Xcode Configuration 24
Objective-C Primer 25
Classes 27
Instantiation 31
Messaging 31
Member Variables 32
Memory Management 33
Constructors and Destructors 33
Interface Builder Integration 34
Mixed C++ and Objective-C 34
Conclusion 34
2. Game Engine Anatomy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Application Framework 35
Main Loop 36
Game State Manager 37
State Machine 38
Graphics Engine 41
Texturing 41
Animation 46
Physics Engine 51
Audio Engine 56
iii
Download at WoweBook.Com