It’s unfortunate that Apple do not provide a charting library bundled with their frameworks, for I suspect that would save many developers the trouble of finding a charting library and deciphering the documentation. I’ve come to the conclusion that CorePlot is the best bet at the moment - it’s powerful and compatible with both iOS and OSX but unfortunately the documentation for isn’t great. So, we’re going to go through the process of adding a simple scatter chart to an iPad application.
When I first started integrating Box2D into my Cocos2D project, I found the whole process a little jarring. While I’d used C++ before, this was the first time I’d seen it mixed with Objective-C. This code snippet simply wraps the standard Box2D Debug calls from GLES-Render.h (included with Cocos2D) in it’s own CCLayer, so that you can implement it quickly and easily. It also allows you to turn the layer on an off easily as you would any other CCLayer.
I recently ran into the situation where I wanted to call NSObject’s performSelectorOnMainThread with multiple arguments. While it wasn’t massively difficult, it was a bit more fiddly than I first expected - you have to get your hands dirty with NSInvocation. I’ve built a category that adds an additional method to NSObject which will allow you to call a performSelectorOnMainThread method with any number of objects as parameters. Feel free to use it in your own projects!
In a game that a friend and I are working on (Knight Terrors) we wanted a system to pre-load animations into CCAnimationFrameCache without having to hardcode any of that configuration. This means that our designer and artist, Jackson Matthews, can add and remove frames from a creature’s animation without having to come back to me with a frame list to paste back into the code. I will assume you have knowledge of CCSpriteFrameCache and CCAnimations within cocos2d before embarking on this.
I recently took it upon myself to write a small application, a bit like Photoshop Express, for Android as a mechanism for learning how to develop on the Android platform. One problem that I stumbled across along was with saving (and subsequently loading) my custom images, which could consist of a number of different layers.
I’m making this post in the hope that it saves someone from the hour of pain that I’ve just been through with StarCraft II. I was running StarCraft 2 version 1.02 and have been playing it on and off for the last week or so (it’s great by the way!). I figured I would have a quick blast before cracking on with some programming this evening, and was annoyed to find it wouldn’t launch.
I recently added the ability to an iPhone Application that we have been developing to allow the end-user to send email to their contacts directly from our application. This turned out to be trivial using the MessageUI Kit that Apple provide with the iPhone SDK. Here we detail how we implemented this in our application.
There are many pages of discussions around the internet about whether or not you should use global variables in your applications. I’m not going to to into the depths of these discussions, but I have come to live by the following ethos when it comes to using global variables in my application;
Having devoted much of my time over the last few months developing for the iPhone, I thought it was time to start collecting a small library of useful code snippets here on my blog. I’m mostly posting these for my own use, so that I don’t have to keep searching Google to keep finding the useful bits of code. However, I’ll try to make the posts as accessible as possible, with some explanation where necessary.