Getting Started iOS

The entire GamesChart API is contained in a single framework that can be easily added to your project.

GameChart is added programatically, but the process is incredibly simple ! Just follow the steps below: {|

Step 1 - Including the framework
1. Download the GamesChart developer pack for IOS GamesChart Developer Pack. 2. Once downloaded, simply unzip the GamesChart.zip file. You will find 2 folders in the zip file, "DEVICE" and "SIMULATOR". Drag the "GCIOSAPI.framework" file from either the "DEVICE" or "SIMULATOR" folders into the "Frameworks" section of your project. NOTE: It is important to add all of the frameworks illustrated in the screenshot to your project. NOTE: Remember to check "Copy items into destination group's folder (if needed)" in the confirmation dialogue

Step 2 - Header Code Setup
Since the GamesChart that will be displayed in your game is a UIView and will exist 'on top' of your game's existing views, we must add it to your games main viewcontroller class. 1. Firstly, in your viewcontroller's header file, add the following line: 2. Now create a new GamesChart reference by adding the following line: GamesChart * gamesChart; Ok, we're done in the header, now head over to your .m file
 * 1) import 

Step 3 - Class File Code Setup
It's up to you when and where you kick off the GamesChart system, but we highly recommend you do it at the end of you "viewDidLoad" function. 1. To initialise the system, just add the following simple block: /////////////////////////////////////////////////////////////////////////////////////////////////////// // STEP 1: INITIALISE GAMESCHART SYSTEM /////////////////////////////////////////////////////////////////////////////////////////////////////// NSString * gameID = @"insert_your_gameschart_game_id_here"; // provided to you when you register your game gamesChart = [[GamesChart alloc] init]; // initialise the system [gamesChart initChart:gameID :true]; // initialise the chart (if your game supports orientation changes                                    // pass 'true' as the 2nd argument, otherwise pass 'false' OPTIONAL: We can also choose to load GameChart in the background by adding the following paramter to the initChart call: [gamesChart initChart:gameID :true: true]; // the second "true" parameter tells GamesChart to load asynchronously. 2. Next, we need to pass through some events to the GamesChart, so we need to add a couple of lines to touchesBegan, touchesMoved and touchesEnded. Don't worry if you don't have these functions, you can just add any you don't have already, otherwise add the GamesChart sections at the end of each of your existing functions: /////////////////////////////////////////////////////////////////////////////////////////////////////// // STEP 2: ADD EVENT HANDLERS ///////////////////////////////////////////////////////////////////////////////////////////////////////

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {   UITouch *touch = [[event allTouches] anyObject];    CGPoint location = [touch locationInView:self.view];    [gamesChart touchBegan:location]; }

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {   UITouch *touch = [[event allTouches] anyObject];    CGPoint location = [touch locationInView:self.view];    [gamesChart touchEnded:location]; }

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {   UITouch *touch = event allTouches] anyObject];    CGPoint location = [touch locationInView:self.view];    [gamesChart touchMoved:location]; } 3. Finally, we need to tell GamesChart to update when our game does. Locate your update function and add the following lines: /////////////////////////////////////////////////////////////////////////////////////////////////////// // STEP 3: UPDATE LOOP /////////////////////////////////////////////////////////////////////////////////////////////////////// if ([gamesChart chartReady]) {    [self.view addSubview:[gamesChart getChart; // add the chart view when it's ready } [gamesChart updateAll]; // update the GamesChart system

That's it !!