Managing effects
As we've been programming our game so far, we have been haphazardly creating without thinking about how our effects will run on older devices.
Have no fear! Because we can detect which device the player is using and adjust our particle effects and the number of enemies that will spawn on the screen at a time.
To begin, in our GameLevelScene.m
file, we will add the following line of code at the top:
#import <sys/utsname.h>
This framework will allow us access to detecting the exact device we are working on.
Just under the @implementation
line, add the following function:
NSString* deviceName() { struct utsname systemInfo; uname(&systemInfo); return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; }
Now, if you want to see which device appears, you can add the deviceName()
function to the NSLog
function in our init section, which would look like this:
NSLog(deviceName());
So, your log will now display...