I've decide to rewrite a java-based game prototype I've been working on in Objective-C. The iOS platform will be a better fit.
Unfortunately I'm having to learn Obj-C at the same time. In the Java game, there were a few libraries that were instantiated by the main game class, and accessed statically when needed. This meant that I could the overhead of new instances each time.
i.e.:
Game.getRNG().nextInt()
or Game.getNoiseGen().noise( x, y )
I'm trying to understand the best method to replicate this in Obj-C. I've looked at examples of singletons and am trying this method, but I'm not sure if this is the best way to do this.
The above code, would apparently translate into something like:
[[[Game getInstance] getNoiseGen] noise]
Is there a better way to create a single instance of library classes and statically reference them from anywhere inside my application code?