cocos2d/cocos2d-x — pull request #1107 by NatWeiss (2012-07-21 04:37:45+00:00)
Title: Adding Mac support!

Got Mac support to work with the latest branch of Cocos2d-X! :)

Resizing the Cocos2d-X Mac window works.

Full screen support works.

Audio works.

Touch input works.

Here's a video of it working:
http://www.youtube.com/watch?v=I5nqC3-GeLM

This pull request mainly features the cocos2dx/platform/mac and CocosDenshion/mac folders.

The cocos2dx/platform/mac folder started with the zip Walzer posted here:
http://cocos2d-x.org/boards/6/topics/10352

I referenced a bit of ImperialPenguin's code, a lot of Cocos2d iPhone 2.0's and got it all working with the latest idioms of Cocos2d-X 2.0. The most difficult part was realizing that CCDirectorMac is not necessary. After incorporating it's main features into EAGLView and CCEGLView, everything started working amazingly. CCWindow is from Cocos2d iPhone and helps the EAGLView setFullScreen function. Input works too, thanks to CCEventDispatcher and setting it in EAGLView's initWithFrame.

There's one function in CCImage that I couldn't get to compile so I commented it out. It's potImageData function. I'm not sure where it belongs in the Cocos2d-X 2.0 paradigm, but the example game that I tried out did not need it to function 100%.

Most of the files in CocosDenshion/mac are a copy of CocosDenshion/ios except for CDXMacOSXSupport which comes from Walzer's zip. Copying them into the CocosDenshion/mac folder allows a person to compile cleanly for Mac without the ios folder, much like how the cocos2dx/platform folder works today.

This pull request was a lot of effort, so I will leave it up to somebody else to create the HelloWorld, tests, and proj.mac folders.