Hello all,
Complete newbie at cocos2d, but I've been writing iPhone code for a few months now, so I'm not totally lost...
I'm trying the first "Hello World" app, but I'm trying to adapt it more closely to my final target, which is using a cocos2d graphics context in a view, among other UIViews, and the interface is built in interface builder. So, this is pretty much everything I changed:
0. Changed all the object names to add "CC" where missing (CCLayer, CCDirector, etc...I guess this changed from 0.8 to 0.99?)
1. Changed attachInWindow:window to attachInView:graphicsView
2. Commented out the setDeviceOrientation call (the NIB is already built in landscape orientation)
3. Put the code in viewDidLoad of the view controller instead of the appDelegate launch method.
So, I got the app to compile and run, and it crashes with a EXC_ARITHMETIC exception within the attachInView call...specifically, down in [CCLabelAtlas updateAtlasValues], on the following line:
float row = (a % itemsPerRow) * texStepX;
where it seems the itemsPerRow is zero, for whatever reason.
Any idea where I'm going wrong? is viewDidLoad the wrong place to initialize things? Does the view I'm attaching to have to be a particular type? (Right now it's just a UIView.)
This is using SDK 3.2, in the iPad simulator, with cocos2d release-0.99.0-rc (from the tag in svn). The UIView I'm attaching to is 1024x448.
Thanks!!