cocos2d iphone - iAd reducing FPS? -
does iad banner reduces fps?
indeed, since added iad fsp shit. 59 game , it's variable 35-50 fps.
any ideas please because game not playable banner.
thank help.
you should implement iad logic in uinavigationcontroller
subclass set in appdelegate
. @ mine code like:
appdelegate.m - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // create main window window_ = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; ccglview *glview = [ccglview viewwithframe:[window_ bounds] pixelformat:keaglcolorformatrgb565 depthformat:0 preservebackbuffer:no sharegroup:nil multisampling:no numberofsamples:0]; // enable multiple touches [glview setmultipletouchenabled:yes]; director_ = (ccdirectorios*) [ccdirector shareddirector]; director_.wantsfullscreenlayout = yes; // display fsp , spf [director_ setdisplaystats:yes]; // set fps @ 60 [director_ setanimationinterval:1.0/60]; //few lines later // create navigation controller director navcontroller_ = [[mynavigationcontroller alloc] initwithrootviewcontroller:director_]; navcontroller_.navigationbarhidden = yes; [self checkdevicetype]; // setup iads bannerview [self setupiads]; // rotation , other messages [director_ setdelegate:navcontroller_]; // set navigation controller root view controller [window_ setrootviewcontroller:navcontroller_]; // make main window visible [window_ makekeyandvisible]; return yes; } - (void)setupiads { cgsize size = [[ccdirector shareddirector] winsize]; float bannerheight = _isipadrunning ? 66.0f : 50.0f; adadtype bannertype = _isipadrunning ? adadtypemediumrectangle : adadtypebanner; _bannerview = [[adbannerview alloc] initwithadtype:bannertype]; _bannerview.frame = cgrectmake(0, navcontroller_.view.frame.size.height, size.width, bannerheight); cgsize newbannersize = [_bannerview sizethatfits:cgsizemake(size.width, bannerheight)]; _bannerview.frame = cgrectmake(0, navcontroller_.view.frame.size.height, newbannersize.width, newbannersize.height); _bannerview.delegate = self; //get view uiview *mainview = [navcontroller_ view]; [mainview addsubview:_bannerview]; [mainview setneedslayout]; }
as can see use navcontroller_
place iad banner view. no fps drops! :) please, try out. me helped , have no fps drops or delay. works great.
Comments
Post a Comment