I have been at work on a puzzle game which supports Android and iOS platforms. I wanted to include advertisements through Admob to help monetize the game while it is getting past the beta stage. So far I’ve succeeded in supporting Admob on Android; iOS is posing more difficulty.
The main problem I’m facing is displaying a custom (i.e. banner advertisement) UIView overlaying the main SDL window. I am quite new to Objective C as well as UIKit development, I guess what I’m not understanding is how the SDL Objective C code shares the screen with the system.
A basic run-down of the calls I’m making so far (btw this is all coded from the imported SDL project, I’m not proficient enough with ObC yet to subclass and instantiate my own objects):
call [GADMobileAds configureWithApplicationID:@“APP_ID”]; in didFinishLaunchingWithOptions
import “GoogleMobileAds/GoogleMobileAds.h” in the header (currently not needed).
in SDL_uikitviewcontroller.m: override
“- (void)viewDidLoad” to create a custom UIView:
CGRect viewRect = CGRectMake(0, 0, 200, 200);
UIView *uiview = [[UIView alloc] initWithFrame : viewRect];
uiview.backgroundColor = [UIColor whiteColor];
and then I’m at a complete loss as to how I share it on the screen with SDL. I’ve attempted exploring the structure of “SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;”, but without any visible results.
I’ve searched for hours on Google without a complete clue, can someone please explain?
The project I’m describing is called ‘Platonic Opaline’, it’s available on Google Play:
and on App Store: