O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — modifying the code to display ads

First, you need to open the main.h header file and make some changes to it. We dive here into Object-C/C++ code, so be confused if the code looks different from the native Monkey code:

  1. Add an import statement for the MobFox/MobFox.h file:
    #include <OpenAL/alc.h>
    #import <MobFox/MobFox.h>
    // ***** MonkeyView *****
    @interface MonkeyView : UIView{
    
  2. Next, add the MobFoxBannerViewDelegate to the Monkey view controller:
    // ***** MonkeyViewController *****
    @interface MonkeyViewController : UIViewController
    <MobFoxBannerViewDelegate> {
    @public
    }
    @end
    
  3. Next, we need to modify the main.m file, the heart of your Monkey code. Insert the viewDidLoad method into the MonkeyViewController implementation and call ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required