Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cocos2D for Fun and Profit

Cocos2D for Fun and Profit

Cocos2D is a fun little 2D graphics library that makes it easier to make OpenGL games. In this talk, you'll learn about the core concepts of Cocos2D.

This was presented by Jon Manning of Secret Lab at Swipe Conference 2012 in Sydney.

Read the blog post at http://blog.secretlab.com.au/2012/09/09/swipe-conference-2012/

Source code is available at https://github.com/thesecretlab/swipeconf2012.

Secret Lab

August 07, 2012
Tweet

More Decks by Secret Lab

Other Decks in Programming

Transcript

  1. Hi!

  2. Neal Goldstein Jon Manning Paris Buttfield-Addison Learn to: • Build

    an actual game from start to finish • Recognize what makes a good game for Apple’s mobile devices • Use Objective-C®, Cocoa®, OpenGL ES 2.0, and other iOS programming tools • Connect your app to Facebook, get it into the App Store, and market it iPhone® & iPad™ Game Development Making Everything Easier!™ ompanion Web site at www.dummies.com/go/ egameprogramming to find plenty of sample other materials to help you create the examples ok Open the book and find: • The latest and greatest on the iPad, iPhone 4, and iOS 4.0 • Elements of great game design and architecture • Why you need to be a registered Apple developer • Why scoring is critical • How to debug your games • What provisioning is and why you need to know • Important social aspects of game design • Key differences between games on the iPad and the iPhone ldstein has a rock-star reputation among iPhone developers. e iPhone Application Development For Dummies and frequently at conferences. Jon Manning and Paris Buttfield-Addison are the rs of Secret Lab, a game design company that builds fun things for e and iPad when the principals aren’t playing games for research. $29.99 US / $35.99 CN / £21.99 UK ISBN 978-0-470-59910-5 Programming/Apple/Mobile Device Go to Dummies.com® for videos, step-by-step examples, how-to articles, or to shop! bby or a — create cool games st devices around! Pad or iPhone game but don’t know ad this book and you will! You’ll see that play wonderfully on the small ed in becoming a registered developer, e SDK, key features of game architecture, games, and more. Get your game on! od game? — learn the fundamentals of good loper’s hat — become a registered Apple how iOS games work, and understand s are made of — build a native user interface, architecture fundamentals, learn to animate and grasp the basics of OpenGL nd get social — set up a scoring system and learn to e into social networks like Facebook o market — get your game into the App Store and etability with such bonus features as gestures, ternal displays, and ad-supported revenue iPhone® & iPad™ Game Development Goldstein Manning Buttfield-Addison spine=1.01”
  3. UIKit Object-oriented Designed for UIs Easy to use, tricky to

    extend OpenGL Immediate mode Designed for 3D Maximum flexibility, steep learning curve
  4. glBindTexture(GL_TEXTURE_2D, 13); glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, imageWidth, imageHeight, 0, GL_RGB,

    GL_UNSIGNED_BYTE, imageData); glBegin (GL_QUADS); ! glTexCoord2f (0.0, 0.0); ! glVertex3f (0.0, 0.0, 0.0); ! glTexCoord2f (1.0, 0.0); ! glVertex3f (10.0, 0.0, 0.0); ! glTexCoord2f (1.0, 1.0); ! glVertex3f (10.0, 10.0, 0.0); ! glTexCoord2f (0.0, 1.0); ! glVertex3f (0.0, 10.0, 0.0); glEnd ();
  5. UIKit Object-oriented Designed for UIs Easy to use, tricky to

    extend OpenGL Immediate mode Designed for 3D Maximum flexibility, steep learning curve
  6. UIKit Object-oriented Designed for UIs Easy to use, tricky to

    extend OpenGL Immediate mode Designed for 3D Maximum flexibility, steep learning curve
  7. UIKit Object-oriented Designed for UIs Easy to use, tricky to

    extend OpenGL Immediate mode Designed for 3D Maximum flexibility, steep learning curve Cocos2D Object-oriented, OpenGL available Designed for 2D Easy to build dynamic 2D scenes
  8. [self schedule: interval: 1.0] Schedule a method to run in

    1 second: @selector(doSomething:) @selector(doSomething:)
  9. [self schedule: interval: 1.0] Schedule a method to run in

    1 second: @selector(addEnemy:) @selector(addEnemy:)
  10. [self schedule: interval: 1.0] Schedule a method to run in

    1 second: @selector(earnPoints:) @selector(earnPoints:)
  11. [self schedule: interval: 1.0] Schedule a method to run in

    1 second: Schedule the update: method to run every frame: [self scheduleUpdate] @selector(earnPoints:) @selector(earnPoints:)
  12. ?