mirror of https://github.com/axmolengine/axmol.git
fixed #iss559
This commit is contained in:
parent
f306c44162
commit
8478288e88
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2008-2011 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -100,6 +101,8 @@ namespace cocos2d{
|
|||
virtual ~CCMenuItemLabel();
|
||||
/** creates a CCMenuItemLabel with a Label, target and selector */
|
||||
static CCMenuItemLabel * itemWithLabel(CCNode*label, SelectorProtocol* target, SEL_MenuHandler selector);
|
||||
/** creates a CCMenuItemLabel with a Label. Target and selector will be nill */
|
||||
static CCMenuItemLabel* itemWithLabel(CCNode *label);
|
||||
/** initializes a CCMenuItemLabel with a Label, target and selector */
|
||||
bool initWithLabel(CCNode* label, SelectorProtocol* target, SEL_MenuHandler selector);
|
||||
/** sets a new string to the inner label */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2008-2011 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -164,6 +165,13 @@ namespace cocos2d{
|
|||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
CCMenuItemLabel* CCMenuItemLabel::itemWithLabel(CCNode *label)
|
||||
{
|
||||
CCMenuItemLabel *pRet = new CCMenuItemLabel();
|
||||
pRet->initWithLabel(label, NULL, NULL);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
bool CCMenuItemLabel::initWithLabel(CCNode* label, SelectorProtocol* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCMenuItem::initWithTarget(target, selector);
|
||||
|
@ -179,9 +187,7 @@ namespace cocos2d{
|
|||
void CCMenuItemLabel::setString(const char * label)
|
||||
{
|
||||
m_pLabel->convertToLabelProtocol()->setString(label);
|
||||
this->setContentSize(m_pLabel->getContentSize());
|
||||
// [label_ setString:string];
|
||||
// [self setContentSize: [label_ contentSize]];
|
||||
this->setContentSize(m_pLabel->getContentSize());
|
||||
}
|
||||
void CCMenuItemLabel::activate()
|
||||
{
|
||||
|
@ -198,8 +204,17 @@ namespace cocos2d{
|
|||
if(m_bIsEnabled)
|
||||
{
|
||||
CCMenuItem::selected();
|
||||
this->stopActionByTag(kZoomActionTag);
|
||||
m_fOriginalScale = this->getScale();
|
||||
|
||||
CCAction *action = getActionByTag(kZoomActionTag);
|
||||
if (action)
|
||||
{
|
||||
this->stopAction(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fOriginalScale = this->getScale();
|
||||
}
|
||||
|
||||
CCAction *zoomAction = CCScaleTo::actionWithDuration(0.1f, m_fOriginalScale * 1.2f);
|
||||
zoomAction->setTag(kZoomActionTag);
|
||||
this->runAction(zoomAction);
|
||||
|
|
Loading…
Reference in New Issue