ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

CCMenuItemSprite does not show #67

Closed vcarluer closed 11 years ago

vcarluer commented 11 years ago

I've updated my cocos2d-android from february 2012 to november version and my menus with sprites are not displayed anymore. CCMenuItemSprite are here because when I select them they appear but normal image is not displayed anymore. I search a little bit in the code but didn't find anything, did you changed something?

code sample:

CCSprite pauseSprite = CCSprite.sprite("control-pause.png", true); CCMenuItemSprite pauseMenu = CCMenuItemSprite.item(pauseSprite, pauseSprite, this, "goPause"); pauseMenu.setScale(pauseScale);

    float left = - CCDirector.sharedDirector().winSize().getWidth() / 2 + ((MenuSprite.Width * pauseScale) + PauseLayer.PaddingX) / 2 ;
    float top = CCDirector.sharedDirector().winSize().getHeight() / 2 - ((MenuSprite.Height * pauseScale) + PauseLayer.PaddingY) / 2;
    pauseMenu.setPosition(CGPoint.make(left, top));

    this.menu = CCMenu.menu(pauseMenu);     
    this.addChild(this.menu);
opengenius commented 11 years ago

Create another sprite with the same frsme for different menu states. 08.11.2012 5:19 ÐÏÌØÚÏ×ÁÔÅÌØ "Vincent Carluer" notifications@github.com ÎÁÐÉÓÁÌ:

I've updated my cocos2d-android from february 2012 to november version and my menus with sprites are not displayed anymore. CCMenuItemSprite are here because when I select them they appear but normal image is not displayed anymore. I search a little bit in the code but didn't find anything, did you changed something?

code sample:

CCSprite pauseSprite = CCSprite.sprite("control-pause.png", true); CCMenuItemSprite pauseMenu = CCMenuItemSprite.item(pauseSprite, pauseSprite, this, "goPause"); pauseMenu.setScale(pauseScale);

float left = - CCDirector.sharedDirector().winSize().getWidth() / 2 + ((MenuSprite.Width * pauseScale) + PauseLayer.PaddingX) / 2 ;
float top = CCDirector.sharedDirector().winSize().getHeight() / 2 - ((MenuSprite.Height * pauseScale) + PauseLayer.PaddingY) / 2;
pauseMenu.setPosition(CGPoint.make(left, top));

this.menu = CCMenu.menu(pauseMenu);
this.addChild(this.menu);

-- Reply to this email directly or view it on GitHubhttps://github.com/ZhouWeikuan/cocos2d/issues/67.

vcarluer commented 11 years ago

You are right, it works thanks! New menu code: CCSprite playSpriteNorm = CCSprite.sprite("control-play.png", true); CCSprite playSpriteSel = CCSprite.sprite("control-play.png", true); CCMenuItemSprite playMenu = CCMenuItemSprite.item(playSpriteNorm, playSpriteSel, this, "selectPlay");