Under the Bridge

cocos2d vs. iPhone 4

So you get this email first thing this morning about your latest game:

I am attaching updated images for <REDACTED> (images for iPhone 4 are added)

Oh, snap. So how much work will it be to get cocos2d, which of course this is written with, to be iPhone 4 savvy?

Well, not too darn much, as of … today! From the man himself:

You need to initialize the EAGLView manually. This is a new feature of v0.99.4-beta.

Eg:

// Create an EAGLView with a RGB8 color buffer, and a depth buffer of 24-bits

EAGLView *glView = [EAGLView viewWithFrame:[window bounds]

pixelFormat:kEAGLColorFormatRGBA8

depthFormat:GL_DEPTH_COMPONENT24_OES

preserveBackbuffer:NO];

// Then call the following methods

[glView <REDACTED>:2]; // a)

[director <REDACTED>:2]; // b)

Once SDK 4.0 is out of beta (no NDA), the “a)” won’t be needed since it will be called from the director.

Example of initializing the EAGLView manually.

(The “<REDACTED>” method name is fairly self-evident if you do, indeed, have the NDA-covered SDK.)

Excellent, excellent. And we got that response in eight minutes flat. No, seriously, eight minutes flat.

Just in case we haven’t mentioned this recently enough, if you’re using cocos2d, you really ought to support its development, as a decent open source graphics engine is pretty rare, and a decent open source graphics engine that’s constantly updated and supported with the speed of hummingbirds on meth, well that’s just completely unheard of. We bought both the Sapus Tongue source and the LevelSVG editor, and so should you!

1