WenSheng Yang wrote:
In my opinion, the content size means the original size of sprite. It wouldn’t be change in normal case.
If you want scale the menu item size, can do like this:
Yes, it works. Thank you. However, I want to use one set of texture image for both low and high screen resolutions. Since I work with managed sprite, the sprite manager scale it based on the current resolution when created.
If the content size remains unchanged, to scale the CCMenuItemImage should not work for its touch zone. Since rect() uses the content size only.
I found another bug. It seems there is a difference between CCMenuItemImage and CCMenuItemSprite.
Try this code, it won’t work.
@ CCSprite * sprite1 = CCSprite::spriteWithFile(“CloseNormal.png”);
CCSprite * sprite2 = CCSprite::spriteWithFile(“CloseSelected.png”);
CCMenuItemSprite * pCloseItem = CCMenuItemSprite::itemFromNormalSprite(sprite1, sprite2, this, menu_selector(HelloWorld::menuCloseCallback));
pCloseItem~~>setPosition~~>getWinSize.width~~ 20, 20) );
CCActionInterval * alphaaction = CCFadeIn::actionWithDuration;
However, the fadein works fine in original CCMenuItemImage pCloseItem.
P.S. One more. Run the push scene test and quit without pop that scene will result in crash.