iphone - CCMenu doesnt work in iPad -


i'm creating universal application , ccmenu appears fine on both iphone, iphone 4 , ipad. buttons nothing when touched on ipad.

i have no specific ipad code other modifying contentscaling property ipad uses same images iphone 4. means same images work on iphone 4 not on ipad.

i using cocos2d 0.99.rc0 , ios 4.1 sdk. don't know start troubleshooting this.

the oddity noticed ipad seems draw menu scene once, redraws reason, moving 1 pixel or something. menu class simple , has no "refreshing" code or supposed move. doesnt happen on either low or high res iphones.

here code, sloppy yet simple.

mainmenu.m:

    ccmenuitemimage * playitem = [self makemenubuttonwithsprite:@"play.png" withselector:@selector(play:)];      ccmenuitemimage * resumeitem = [self makemenubuttonwithsprite:@"resume.png" withselector:@selector(resume:)];      ccmenuitemimage * optionsitem = [self makemenubuttonwithsprite:@"options.png" withselector:@selector(options:)];      ccmenuitemimage * helpitem = [self makemenubuttonwithsprite:@"help.png" withselector:@selector(help:)];      ccmenu *mymenu;      // check if there valid savegame comparing versions.     if ([[ud stringforkey:@"cfbundleversion"] isequaltostring:[[nsbundle mainbundle] objectforinfodictionarykey:@"cfbundleversion"]] ) {         mymenu = [ccmenu menuwithitems:playitem, resumeitem, optionsitem, helpitem, nil];     } else {         mymenu = [ccmenu menuwithitems:playitem, optionsitem, helpitem, nil];     }      // arrange menu items vertically     [mymenu alignitemsverticallywithpadding:0.0f];     mymenu.position = ccp(db.wwidth/2,db.wheight/2);      // add menu scene     [self addchild:mymenu z:100]; 

and ccmenuitemimage factory:

- (ccmenuitemimage *)makemenubuttonwithsprite:(nsstring *)spritefilename withselector:(sel)selector {     ccsprite *spriteforbutton = [ccsprite spritewithfile:spritefilename];     spriteforbutton.anchorpoint = ccp(0.5f,0.5f);     ccmenuitemimage * buttonimage =[ccmenuitemimage itemfromnormalimage:@"button.png"                                                       selectedimage: @"button.png"                                                              target:self                                                            selector:selector];     [buttonimage addchild:spriteforbutton z:100];     spriteforbutton.position = ccp([buttonimage boundingbox].size.width/2,([buttonimage boundingbox].size.height/2)-5);     return buttonimage; } 

i don't think known bug exists issue. not sure how debug without seeing code, but, if helps, here's code of mine adds menu using cocos2d 0.99.5, on ios 4.0, 4.1 , 4.2 (no difference when upgraded):

-(void) initbottommenu { ccmenuitem *aboutbutton = [self gamebuttonwithname:@"about" selector:@selector(onabout:)]; ccmenuitem *settingsbutton = [self gamebuttonwithname:@"settings" selector:@selector(onsettings:)]; ccmenuitem *tutbutton = [self gamebuttonwithname:@"tutorial" selector:@selector(ontutorial:)];  ccmenu *menu = [ccmenu menuwithitems:aboutbutton, settingsbutton, tutbutton, nil]; menu.position = ccp(xpos, ypos);  [menu alignitemshorizontallywithpadding:45.0];  [self addchild:menu]; } 

the gamebuttonwithname:selector: method looks this:

-(ccmenuitem *) gamebuttonwithname:(nsstring *)name selector:(sel)s {  nsstring *ipadsuffix = @"ipad";  nsstring *normal    = [[nsstring alloc] initwithformat:@"%@btn%@.png", name, ipadsuffix, nil]   ; nsstring *selected  = [[nsstring alloc] initwithformat:@"%@btn%@.png", name, ipadsuffix, nil];  ccmenuitem *retbutton = [ccmenuitemimage itemfromnormalimage:normal                                                selectedimage:selected                                                disabledimage:selected                                                       target:self                                                     selector:s];  [selected release]; [normal release];  return retbutton; } 

sort of sloppy, works out adding menu main scene.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -