2012-09-25 17:26:09 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2012 cocos2d-x.org
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Created by Jung Sang-Taik on 12. 3. 16..
|
|
|
|
Copyright (c) 2012 Neofect. All rights reserved.
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
2012-04-16 18:58:43 +08:00
|
|
|
|
|
|
|
#include "CCScale9Sprite.h"
|
2012-04-17 11:12:05 +08:00
|
|
|
|
2012-04-27 18:47:49 +08:00
|
|
|
NS_CC_EXT_BEGIN
|
2012-04-16 18:58:43 +08:00
|
|
|
|
2012-09-25 16:57:51 +08:00
|
|
|
enum positions
|
|
|
|
{
|
|
|
|
pCentre = 0,
|
|
|
|
pTop,
|
|
|
|
pLeft,
|
|
|
|
pRight,
|
|
|
|
pBottom,
|
|
|
|
pTopRight,
|
|
|
|
pTopLeft,
|
|
|
|
pBottomRight,
|
|
|
|
pBottomLeft
|
|
|
|
};
|
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
CCScale9Sprite::CCScale9Sprite()
|
2012-06-01 03:03:33 +08:00
|
|
|
: m_insetLeft(0)
|
|
|
|
, m_insetTop(0)
|
|
|
|
, m_insetRight(0)
|
|
|
|
, m_insetBottom(0)
|
2012-09-25 17:26:09 +08:00
|
|
|
, m_bSpritesGenerated(false)
|
|
|
|
, m_bSpriteFrameRotated(false)
|
|
|
|
, m_positionsAreDirty(false)
|
|
|
|
, scale9Image(NULL)
|
|
|
|
, topLeft(NULL)
|
|
|
|
, top(NULL)
|
|
|
|
, topRight(NULL)
|
|
|
|
, left(NULL)
|
|
|
|
, centre(NULL)
|
|
|
|
, right(NULL)
|
|
|
|
, bottomLeft(NULL)
|
|
|
|
, bottom(NULL)
|
|
|
|
, bottomRight(NULL)
|
2012-09-25 16:57:51 +08:00
|
|
|
, m_bIsOpacityModifyRGB(false)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-06-01 03:37:28 +08:00
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCScale9Sprite::~CCScale9Sprite()
|
|
|
|
{
|
2012-09-25 16:57:51 +08:00
|
|
|
CC_SAFE_RELEASE(topLeft);
|
|
|
|
CC_SAFE_RELEASE(top);
|
|
|
|
CC_SAFE_RELEASE(topRight);
|
|
|
|
CC_SAFE_RELEASE(left);
|
|
|
|
CC_SAFE_RELEASE(centre);
|
|
|
|
CC_SAFE_RELEASE(right);
|
|
|
|
CC_SAFE_RELEASE(bottomLeft);
|
|
|
|
CC_SAFE_RELEASE(bottom);
|
|
|
|
CC_SAFE_RELEASE(bottomRight);
|
|
|
|
CC_SAFE_RELEASE(scale9Image);
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
2012-06-01 02:47:16 +08:00
|
|
|
bool CCScale9Sprite::init()
|
|
|
|
{
|
|
|
|
return this->initWithBatchNode(NULL, CCRectZero, CCRectZero);
|
|
|
|
}
|
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, CCRect capInsets)
|
2012-09-25 16:57:51 +08:00
|
|
|
{
|
|
|
|
return this->initWithBatchNode(batchnode, rect, false, capInsets);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-06-01 02:47:16 +08:00
|
|
|
if(batchnode)
|
|
|
|
{
|
2012-09-25 16:57:51 +08:00
|
|
|
this->updateWithBatchNode(batchnode, rect, rotated, capInsets);
|
2012-06-01 03:37:28 +08:00
|
|
|
this->setAnchorPoint(ccp(0.5f, 0.5f));
|
2012-06-01 02:47:16 +08:00
|
|
|
}
|
|
|
|
this->m_positionsAreDirty = true;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-15 15:36:36 +08:00
|
|
|
return true;
|
2012-06-01 02:47:16 +08:00
|
|
|
}
|
|
|
|
|
2013-01-24 08:42:14 +08:00
|
|
|
#define TRANSLATE_X(x, y, xtranslate) \
|
|
|
|
x+=xtranslate; \
|
|
|
|
|
|
|
|
#define TRANSLATE_Y(x, y, ytranslate) \
|
|
|
|
y+=ytranslate; \
|
|
|
|
|
2012-09-25 16:57:51 +08:00
|
|
|
bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets)
|
2012-06-01 02:47:16 +08:00
|
|
|
{
|
2013-02-28 11:55:36 +08:00
|
|
|
GLubyte opacity = getOpacity();
|
|
|
|
ccColor3B color = getColor();
|
2012-09-25 16:57:51 +08:00
|
|
|
|
2012-06-01 02:47:16 +08:00
|
|
|
// Release old sprites
|
|
|
|
this->removeAllChildrenWithCleanup(true);
|
|
|
|
|
2012-09-25 16:57:51 +08:00
|
|
|
CC_SAFE_RELEASE(this->centre);
|
|
|
|
CC_SAFE_RELEASE(this->top);
|
|
|
|
CC_SAFE_RELEASE(this->topLeft);
|
|
|
|
CC_SAFE_RELEASE(this->topRight);
|
|
|
|
CC_SAFE_RELEASE(this->left);
|
|
|
|
CC_SAFE_RELEASE(this->right);
|
|
|
|
CC_SAFE_RELEASE(this->bottomLeft);
|
|
|
|
CC_SAFE_RELEASE(this->bottom);
|
|
|
|
CC_SAFE_RELEASE(this->bottomRight);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-01 02:47:16 +08:00
|
|
|
if(this->scale9Image != batchnode)
|
2013-02-12 05:26:40 +08:00
|
|
|
{
|
|
|
|
CC_SAFE_RELEASE(this->scale9Image);
|
|
|
|
scale9Image = batchnode;
|
|
|
|
CC_SAFE_RETAIN(scale9Image);
|
|
|
|
}
|
2012-06-01 02:47:16 +08:00
|
|
|
|
|
|
|
scale9Image->removeAllChildrenWithCleanup(true);
|
|
|
|
|
|
|
|
m_capInsets = capInsets;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// If there is no given rect
|
2012-08-01 15:30:12 +08:00
|
|
|
if ( rect.equals(CCRectZero) )
|
2013-02-12 05:26:40 +08:00
|
|
|
{
|
|
|
|
// Get the texture size as original
|
|
|
|
CCSize textureSize = scale9Image->getTextureAtlas()->getTexture()->getContentSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
rect = CCRectMake(0, 0, textureSize.width, textureSize.height);
|
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// Set the given rect's size as original size
|
|
|
|
m_spriteRect = rect;
|
|
|
|
m_originalSize = rect.size;
|
|
|
|
m_preferredSize = m_originalSize;
|
2012-06-01 02:47:16 +08:00
|
|
|
m_capInsetsInternal = capInsets;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-09-25 16:57:51 +08:00
|
|
|
float w = rect.size.width;
|
2013-02-12 05:26:40 +08:00
|
|
|
float h = rect.size.height;
|
2012-09-25 16:57:51 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// If there is no specified center region
|
2012-08-01 15:30:12 +08:00
|
|
|
if ( m_capInsetsInternal.equals(CCRectZero) )
|
2012-09-25 16:57:51 +08:00
|
|
|
{
|
2013-02-12 05:26:40 +08:00
|
|
|
// CCLog("... cap insets not specified : using default cap insets ...");
|
2013-01-24 08:42:14 +08:00
|
|
|
m_capInsetsInternal = CCRectMake(w/3, h/3, w/3, h/3);
|
2012-09-25 16:57:51 +08:00
|
|
|
}
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
float left_w = m_capInsetsInternal.origin.x;
|
|
|
|
float center_w = m_capInsetsInternal.size.width;
|
|
|
|
float right_w = rect.size.width - (left_w + center_w);
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
float top_h = m_capInsetsInternal.origin.y;
|
|
|
|
float center_h = m_capInsetsInternal.size.height;
|
|
|
|
float bottom_h = rect.size.height - (top_h + center_h);
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
// calculate rects
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
// ... top row
|
|
|
|
float x = 0.0;
|
|
|
|
float y = 0.0;
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
// top left
|
|
|
|
CCRect lefttopbounds = CCRectMake(x, y,
|
|
|
|
left_w, top_h);
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
// top center
|
|
|
|
TRANSLATE_X(x, y, left_w);
|
|
|
|
CCRect centertopbounds = CCRectMake(x, y,
|
|
|
|
center_w, top_h);
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2013-02-12 05:26:40 +08:00
|
|
|
// top right
|
|
|
|
TRANSLATE_X(x, y, center_w);
|
|
|
|
CCRect righttopbounds = CCRectMake(x, y,
|
|
|
|
right_w, top_h);
|
|
|
|
|
|
|
|
// ... center row
|
|
|
|
x = 0.0;
|
|
|
|
y = 0.0;
|
|
|
|
TRANSLATE_Y(x, y, top_h);
|
|
|
|
|
|
|
|
// center left
|
|
|
|
CCRect leftcenterbounds = CCRectMake(x, y,
|
|
|
|
left_w, center_h);
|
|
|
|
|
|
|
|
// center center
|
|
|
|
TRANSLATE_X(x, y, left_w);
|
|
|
|
CCRect centerbounds = CCRectMake(x, y,
|
|
|
|
center_w, center_h);
|
|
|
|
|
|
|
|
// center right
|
|
|
|
TRANSLATE_X(x, y, center_w);
|
|
|
|
CCRect rightcenterbounds = CCRectMake(x, y,
|
|
|
|
right_w, center_h);
|
|
|
|
|
|
|
|
// ... bottom row
|
|
|
|
x = 0.0;
|
|
|
|
y = 0.0;
|
|
|
|
TRANSLATE_Y(x, y, top_h);
|
|
|
|
TRANSLATE_Y(x, y, center_h);
|
|
|
|
|
|
|
|
// bottom left
|
|
|
|
CCRect leftbottombounds = CCRectMake(x, y,
|
|
|
|
left_w, bottom_h);
|
|
|
|
|
|
|
|
// bottom center
|
|
|
|
TRANSLATE_X(x, y, left_w);
|
|
|
|
CCRect centerbottombounds = CCRectMake(x, y,
|
|
|
|
center_w, bottom_h);
|
|
|
|
|
|
|
|
// bottom right
|
|
|
|
TRANSLATE_X(x, y, center_w);
|
|
|
|
CCRect rightbottombounds = CCRectMake(x, y,
|
|
|
|
right_w, bottom_h);
|
|
|
|
|
|
|
|
if (!rotated) {
|
|
|
|
// CCLog("!rotated");
|
|
|
|
|
|
|
|
CCAffineTransform t = CCAffineTransformMakeIdentity();
|
|
|
|
t = CCAffineTransformTranslate(t, rect.origin.x, rect.origin.y);
|
|
|
|
|
|
|
|
centerbounds = CCRectApplyAffineTransform(centerbounds, t);
|
|
|
|
rightbottombounds = CCRectApplyAffineTransform(rightbottombounds, t);
|
|
|
|
leftbottombounds = CCRectApplyAffineTransform(leftbottombounds, t);
|
|
|
|
righttopbounds = CCRectApplyAffineTransform(righttopbounds, t);
|
|
|
|
lefttopbounds = CCRectApplyAffineTransform(lefttopbounds, t);
|
|
|
|
rightcenterbounds = CCRectApplyAffineTransform(rightcenterbounds, t);
|
|
|
|
leftcenterbounds = CCRectApplyAffineTransform(leftcenterbounds, t);
|
|
|
|
centerbottombounds = CCRectApplyAffineTransform(centerbottombounds, t);
|
|
|
|
centertopbounds = CCRectApplyAffineTransform(centertopbounds, t);
|
2013-01-24 08:42:14 +08:00
|
|
|
|
2012-09-25 16:57:51 +08:00
|
|
|
// Centre
|
|
|
|
centre = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
centre->initWithTexture(scale9Image->getTexture(), centerbounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(centre, 0, pCentre);
|
|
|
|
|
|
|
|
// Top
|
|
|
|
top = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
top->initWithTexture(scale9Image->getTexture(), centertopbounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(top, 1, pTop);
|
|
|
|
|
|
|
|
// Bottom
|
|
|
|
bottom = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
bottom->initWithTexture(scale9Image->getTexture(), centerbottombounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(bottom, 1, pBottom);
|
|
|
|
|
|
|
|
// Left
|
|
|
|
left = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
left->initWithTexture(scale9Image->getTexture(), leftcenterbounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(left, 1, pLeft);
|
|
|
|
|
|
|
|
// Right
|
|
|
|
right = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
right->initWithTexture(scale9Image->getTexture(), rightcenterbounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(right, 1, pRight);
|
|
|
|
|
|
|
|
// Top left
|
|
|
|
topLeft = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
topLeft->initWithTexture(scale9Image->getTexture(), lefttopbounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(topLeft, 2, pTopLeft);
|
|
|
|
|
|
|
|
// Top right
|
|
|
|
topRight = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
topRight->initWithTexture(scale9Image->getTexture(), righttopbounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(topRight, 2, pTopRight);
|
|
|
|
|
|
|
|
// Bottom left
|
|
|
|
bottomLeft = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
bottomLeft->initWithTexture(scale9Image->getTexture(), leftbottombounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(bottomLeft, 2, pBottomLeft);
|
|
|
|
|
|
|
|
// Bottom right
|
|
|
|
bottomRight = new CCSprite();
|
2013-01-24 08:42:14 +08:00
|
|
|
bottomRight->initWithTexture(scale9Image->getTexture(), rightbottombounds);
|
2012-09-25 16:57:51 +08:00
|
|
|
scale9Image->addChild(bottomRight, 2, pBottomRight);
|
2013-02-12 05:26:40 +08:00
|
|
|
} else {
|
|
|
|
// set up transformation of coordinates
|
|
|
|
// to handle the case where the sprite is stored rotated
|
|
|
|
// in the spritesheet
|
|
|
|
// CCLog("rotated");
|
|
|
|
|
|
|
|
float midpointx = rect.origin.x + (rect.size.width/2);
|
|
|
|
float midpointy = rect.origin.y + (rect.size.height/2);
|
|
|
|
|
|
|
|
CCAffineTransform t = CCAffineTransformMakeIdentity();
|
|
|
|
|
|
|
|
// RIGHT TO LEFT!
|
|
|
|
t = CCAffineTransformTranslate(t, midpointx, midpointy);
|
|
|
|
t = CCAffineTransformScale(t, -1.0, -1.0);
|
|
|
|
t = CCAffineTransformRotate(t, -1.57079633);
|
|
|
|
t = CCAffineTransformTranslate(t, -midpointx, -midpointy);
|
|
|
|
|
|
|
|
t = CCAffineTransformTranslate(t, rect.origin.x, rect.origin.y);
|
|
|
|
|
|
|
|
centerbounds = CCRectApplyAffineTransform(centerbounds, t);
|
|
|
|
rightbottombounds = CCRectApplyAffineTransform(rightbottombounds, t);
|
|
|
|
leftbottombounds = CCRectApplyAffineTransform(leftbottombounds, t);
|
|
|
|
righttopbounds = CCRectApplyAffineTransform(righttopbounds, t);
|
|
|
|
lefttopbounds = CCRectApplyAffineTransform(lefttopbounds, t);
|
|
|
|
rightcenterbounds = CCRectApplyAffineTransform(rightcenterbounds, t);
|
|
|
|
leftcenterbounds = CCRectApplyAffineTransform(leftcenterbounds, t);
|
|
|
|
centerbottombounds = CCRectApplyAffineTransform(centerbottombounds, t);
|
|
|
|
centertopbounds = CCRectApplyAffineTransform(centertopbounds, t);
|
|
|
|
|
|
|
|
// Centre
|
|
|
|
centre = new CCSprite();
|
|
|
|
centre->initWithTexture(scale9Image->getTexture(), centerbounds, true);
|
|
|
|
scale9Image->addChild(centre, 0, pCentre);
|
|
|
|
|
|
|
|
// Top
|
|
|
|
top = new CCSprite();
|
|
|
|
top->initWithTexture(scale9Image->getTexture(), centertopbounds, true);
|
|
|
|
scale9Image->addChild(top, 1, pTop);
|
|
|
|
|
|
|
|
// Bottom
|
|
|
|
bottom = new CCSprite();
|
|
|
|
bottom->initWithTexture(scale9Image->getTexture(), centerbottombounds, true);
|
|
|
|
scale9Image->addChild(bottom, 1, pBottom);
|
|
|
|
|
|
|
|
// Left
|
|
|
|
left = new CCSprite();
|
|
|
|
left->initWithTexture(scale9Image->getTexture(), leftcenterbounds, true);
|
|
|
|
scale9Image->addChild(left, 1, pLeft);
|
|
|
|
|
|
|
|
// Right
|
|
|
|
right = new CCSprite();
|
|
|
|
right->initWithTexture(scale9Image->getTexture(), rightcenterbounds, true);
|
|
|
|
scale9Image->addChild(right, 1, pRight);
|
|
|
|
|
|
|
|
// Top left
|
|
|
|
topLeft = new CCSprite();
|
|
|
|
topLeft->initWithTexture(scale9Image->getTexture(), lefttopbounds, true);
|
|
|
|
scale9Image->addChild(topLeft, 2, pTopLeft);
|
|
|
|
|
|
|
|
// Top right
|
|
|
|
topRight = new CCSprite();
|
|
|
|
topRight->initWithTexture(scale9Image->getTexture(), righttopbounds, true);
|
|
|
|
scale9Image->addChild(topRight, 2, pTopRight);
|
|
|
|
|
|
|
|
// Bottom left
|
|
|
|
bottomLeft = new CCSprite();
|
|
|
|
bottomLeft->initWithTexture(scale9Image->getTexture(), leftbottombounds, true);
|
|
|
|
scale9Image->addChild(bottomLeft, 2, pBottomLeft);
|
|
|
|
|
|
|
|
// Bottom right
|
|
|
|
bottomRight = new CCSprite();
|
|
|
|
bottomRight->initWithTexture(scale9Image->getTexture(), rightbottombounds, true);
|
|
|
|
scale9Image->addChild(bottomRight, 2, pBottomRight);
|
2012-09-25 16:57:51 +08:00
|
|
|
}
|
2013-02-12 05:26:40 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
this->setContentSize(rect.size);
|
|
|
|
this->addChild(scale9Image);
|
|
|
|
|
2012-09-25 17:26:09 +08:00
|
|
|
if (m_bSpritesGenerated)
|
2013-02-12 05:26:40 +08:00
|
|
|
{
|
|
|
|
// Restore color and opacity
|
|
|
|
this->setOpacity(opacity);
|
|
|
|
this->setColor(color);
|
|
|
|
}
|
2012-09-25 16:57:51 +08:00
|
|
|
m_bSpritesGenerated = true;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
return true;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCScale9Sprite::setContentSize(const CCSize &size)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCNode::setContentSize(size);
|
2012-06-01 02:47:16 +08:00
|
|
|
this->m_positionsAreDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCScale9Sprite::updatePositions()
|
|
|
|
{
|
2013-01-25 07:43:10 +08:00
|
|
|
// Check that instances are non-NULL
|
|
|
|
if(!((topLeft) &&
|
|
|
|
(topRight) &&
|
|
|
|
(bottomRight) &&
|
|
|
|
(bottomLeft) &&
|
|
|
|
(centre))) {
|
|
|
|
// if any of the above sprites are NULL, return
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-11-15 18:34:23 +08:00
|
|
|
CCSize size = this->m_obContentSize;
|
2012-06-01 02:47:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
float sizableWidth = size.width - topLeft->getContentSize().width - topRight->getContentSize().width;
|
|
|
|
float sizableHeight = size.height - topLeft->getContentSize().height - bottomRight->getContentSize().height;
|
2012-09-25 16:57:51 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
float horizontalScale = sizableWidth/centre->getContentSize().width;
|
|
|
|
float verticalScale = sizableHeight/centre->getContentSize().height;
|
2012-09-25 16:57:51 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
centre->setScaleX(horizontalScale);
|
|
|
|
centre->setScaleY(verticalScale);
|
2012-09-25 16:57:51 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
float rescaledWidth = centre->getContentSize().width * horizontalScale;
|
|
|
|
float rescaledHeight = centre->getContentSize().height * verticalScale;
|
2012-06-01 02:47:16 +08:00
|
|
|
|
|
|
|
float leftWidth = bottomLeft->getContentSize().width;
|
|
|
|
float bottomHeight = bottomLeft->getContentSize().height;
|
|
|
|
|
|
|
|
bottomLeft->setAnchorPoint(ccp(0,0));
|
|
|
|
bottomRight->setAnchorPoint(ccp(0,0));
|
|
|
|
topLeft->setAnchorPoint(ccp(0,0));
|
|
|
|
topRight->setAnchorPoint(ccp(0,0));
|
|
|
|
left->setAnchorPoint(ccp(0,0));
|
|
|
|
right->setAnchorPoint(ccp(0,0));
|
|
|
|
top->setAnchorPoint(ccp(0,0));
|
|
|
|
bottom->setAnchorPoint(ccp(0,0));
|
|
|
|
centre->setAnchorPoint(ccp(0,0));
|
|
|
|
|
|
|
|
// Position corners
|
|
|
|
bottomLeft->setPosition(ccp(0,0));
|
|
|
|
bottomRight->setPosition(ccp(leftWidth+rescaledWidth,0));
|
|
|
|
topLeft->setPosition(ccp(0, bottomHeight+rescaledHeight));
|
|
|
|
topRight->setPosition(ccp(leftWidth+rescaledWidth, bottomHeight+rescaledHeight));
|
|
|
|
|
|
|
|
// Scale and position borders
|
|
|
|
left->setPosition(ccp(0, bottomHeight));
|
|
|
|
left->setScaleY(verticalScale);
|
|
|
|
right->setPosition(ccp(leftWidth+rescaledWidth,bottomHeight));
|
|
|
|
right->setScaleY(verticalScale);
|
|
|
|
bottom->setPosition(ccp(leftWidth,0));
|
|
|
|
bottom->setScaleX(horizontalScale);
|
|
|
|
top->setPosition(ccp(leftWidth,bottomHeight+rescaledHeight));
|
2012-04-19 14:35:52 +08:00
|
|
|
top->setScaleX(horizontalScale);
|
2012-06-01 02:47:16 +08:00
|
|
|
|
|
|
|
// Position centre
|
|
|
|
centre->setPosition(ccp(leftWidth, bottomHeight));
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithFile(const char* file, CCRect rect, CCRect capInsets)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCAssert(file != NULL, "Invalid file for sprite");
|
2012-04-16 18:58:43 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::create(file, 9);
|
2012-04-16 18:58:43 +08:00
|
|
|
bool pReturn = this->initWithBatchNode(batchnode, rect, capInsets);
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScale9Sprite* CCScale9Sprite::create(const char* file, CCRect rect, CCRect capInsets)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithFile(file, rect, capInsets) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithFile(const char* file, CCRect rect)
|
|
|
|
{
|
2012-09-25 16:57:51 +08:00
|
|
|
CCAssert(file != NULL, "Invalid file for sprite");
|
2012-04-16 18:58:43 +08:00
|
|
|
bool pReturn = this->initWithFile(file, rect, CCRectZero);
|
|
|
|
return pReturn;
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
|
|
|
CCScale9Sprite* CCScale9Sprite::create(const char* file, CCRect rect)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithFile(file, rect) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithFile(CCRect capInsets, const char* file)
|
|
|
|
{
|
|
|
|
bool pReturn = this->initWithFile(file, CCRectZero, capInsets);
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScale9Sprite* CCScale9Sprite::create(CCRect capInsets, const char* file)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
2013-01-21 21:55:45 +08:00
|
|
|
if ( pReturn && pReturn->initWithFile(capInsets, file) )
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithFile(const char* file)
|
|
|
|
{
|
|
|
|
bool pReturn = this->initWithFile(file, CCRectZero);
|
|
|
|
return pReturn;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
|
|
|
CCScale9Sprite* CCScale9Sprite::create(const char* file)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithFile(file) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets)
|
|
|
|
{
|
2013-01-24 08:42:14 +08:00
|
|
|
CCTexture2D* texture = spriteFrame->getTexture();
|
|
|
|
CCAssert(texture != NULL, "CCTexture must be not nil");
|
|
|
|
|
|
|
|
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::createWithTexture(texture, 9);
|
|
|
|
CCAssert(batchnode != NULL, "CCSpriteBatchNode must be not nil");
|
2012-06-01 02:47:16 +08:00
|
|
|
|
2012-09-25 16:57:51 +08:00
|
|
|
bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), capInsets);
|
2012-04-16 18:58:43 +08:00
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithSpriteFrame(spriteFrame, capInsets) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
bool CCScale9Sprite::initWithSpriteFrame(CCSpriteFrame* spriteFrame)
|
|
|
|
{
|
2012-09-25 16:57:51 +08:00
|
|
|
CCAssert(spriteFrame != NULL, "Invalid spriteFrame for sprite");
|
2012-04-19 14:35:52 +08:00
|
|
|
bool pReturn = this->initWithSpriteFrame(spriteFrame, CCRectZero);
|
2012-04-16 18:58:43 +08:00
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrame(CCSpriteFrame* spriteFrame)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithSpriteFrame(spriteFrame) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithSpriteFrameName(const char* spriteFrameName, CCRect capInsets)
|
|
|
|
{
|
2013-01-24 08:42:14 +08:00
|
|
|
CCAssert((CCSpriteFrameCache::sharedSpriteFrameCache()) != NULL, "sharedSpriteFrameCache must be non-NULL");
|
2012-06-01 02:47:16 +08:00
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(spriteFrameName);
|
2013-01-24 08:42:14 +08:00
|
|
|
CCAssert(frame != NULL, "CCSpriteFrame must be non-NULL");
|
|
|
|
|
|
|
|
if (NULL == frame) return false;
|
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
bool pReturn = this->initWithSpriteFrame(frame, capInsets);
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrameName(const char* spriteFrameName, CCRect capInsets)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithSpriteFrameName(spriteFrameName, capInsets) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CCScale9Sprite::initWithSpriteFrameName(const char* spriteFrameName)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
bool pReturn = this->initWithSpriteFrameName(spriteFrameName, CCRectZero);
|
2012-04-16 18:58:43 +08:00
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrameName(const char* spriteFrameName)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2013-01-24 08:42:14 +08:00
|
|
|
CCAssert(spriteFrameName != NULL, "spriteFrameName must be non-NULL");
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithSpriteFrameName(spriteFrameName) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
2013-01-24 08:42:14 +08:00
|
|
|
|
|
|
|
CCLog("Could not allocate CCScale9Sprite()");
|
2012-04-19 14:35:52 +08:00
|
|
|
return NULL;
|
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCScale9Sprite* CCScale9Sprite::resizableSpriteWithCapInsets(CCRect capInsets)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScale9Sprite* pReturn = new CCScale9Sprite();
|
|
|
|
if ( pReturn && pReturn->initWithBatchNode(scale9Image, m_spriteRect, capInsets) )
|
|
|
|
{
|
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScale9Sprite* CCScale9Sprite::create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-06-14 05:19:13 +08:00
|
|
|
CCScale9Sprite *pReturn = new CCScale9Sprite();
|
|
|
|
if (pReturn)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-06-14 05:19:13 +08:00
|
|
|
pReturn->autorelease();
|
|
|
|
return pReturn;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
2012-06-14 05:19:13 +08:00
|
|
|
CC_SAFE_DELETE(pReturn);
|
|
|
|
return NULL;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** sets the opacity.
|
|
|
|
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
|
|
|
|
Values goes from 0 to 255, where 255 means fully opaque.
|
|
|
|
*/
|
|
|
|
|
2012-06-01 02:47:16 +08:00
|
|
|
void CCScale9Sprite::setPreferredSize(CCSize preferedSize)
|
|
|
|
{
|
|
|
|
this->setContentSize(preferedSize);
|
|
|
|
this->m_preferredSize = preferedSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
CCSize CCScale9Sprite::getPreferredSize()
|
|
|
|
{
|
|
|
|
return this->m_preferredSize;
|
|
|
|
}
|
2012-04-16 18:58:43 +08:00
|
|
|
|
|
|
|
void CCScale9Sprite::setCapInsets(CCRect capInsets)
|
|
|
|
{
|
2012-11-15 18:34:23 +08:00
|
|
|
CCSize contentSize = this->m_obContentSize;
|
2012-09-25 16:57:51 +08:00
|
|
|
this->updateWithBatchNode(this->scale9Image, this->m_spriteRect, m_bSpriteFrameRotated, capInsets);
|
2012-06-01 02:47:16 +08:00
|
|
|
this->setContentSize(contentSize);
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCRect CCScale9Sprite::getCapInsets()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return m_capInsets;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
2012-06-01 02:47:16 +08:00
|
|
|
void CCScale9Sprite::updateCapInset()
|
|
|
|
{
|
|
|
|
CCRect insets;
|
|
|
|
if (this->m_insetLeft == 0 && this->m_insetTop == 0 && this->m_insetRight == 0 && this->m_insetBottom == 0)
|
|
|
|
{
|
|
|
|
insets = CCRectZero;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-25 17:26:09 +08:00
|
|
|
if (m_bSpriteFrameRotated)
|
|
|
|
{
|
|
|
|
insets = CCRectMake(m_spriteRect.origin.x + m_insetBottom,
|
|
|
|
m_spriteRect.origin.y + m_insetLeft,
|
|
|
|
m_spriteRect.size.width-m_insetRight-m_insetLeft,
|
|
|
|
m_spriteRect.size.height-m_insetTop-m_insetBottom);
|
|
|
|
}
|
|
|
|
else
|
2012-09-25 16:57:51 +08:00
|
|
|
{
|
2012-09-25 17:26:09 +08:00
|
|
|
insets = CCRectMake(m_spriteRect.origin.x + m_insetLeft,
|
|
|
|
m_spriteRect.origin.y + m_insetTop,
|
|
|
|
m_spriteRect.size.width-m_insetLeft-m_insetRight,
|
2012-09-25 16:57:51 +08:00
|
|
|
m_spriteRect.size.height-m_insetTop-m_insetBottom);
|
|
|
|
}
|
2012-06-01 02:47:16 +08:00
|
|
|
}
|
|
|
|
this->setCapInsets(insets);
|
|
|
|
}
|
|
|
|
|
2012-06-15 15:10:40 +08:00
|
|
|
void CCScale9Sprite::setOpacityModifyRGB(bool var)
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
m_bIsOpacityModifyRGB = var;
|
|
|
|
if (scale9Image->getChildren() && scale9Image->getChildren()->count() != 0)
|
|
|
|
{
|
|
|
|
CCObject* child;
|
|
|
|
CCARRAY_FOREACH(scale9Image->getChildren(), child)
|
|
|
|
{
|
|
|
|
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
|
|
|
if (pNode)
|
|
|
|
{
|
2012-06-15 15:10:40 +08:00
|
|
|
pNode->setOpacityModifyRGB(m_bIsOpacityModifyRGB);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
2012-06-15 15:10:40 +08:00
|
|
|
bool CCScale9Sprite::isOpacityModifyRGB()
|
2012-04-16 18:58:43 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return m_bIsOpacityModifyRGB;
|
2012-04-16 18:58:43 +08:00
|
|
|
}
|
|
|
|
|
2012-06-01 02:47:16 +08:00
|
|
|
void CCScale9Sprite::setSpriteFrame(CCSpriteFrame * spriteFrame)
|
|
|
|
{
|
2012-07-23 22:49:11 +08:00
|
|
|
CCSpriteBatchNode * batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9);
|
2012-09-25 16:57:51 +08:00
|
|
|
this->updateWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), CCRectZero);
|
2012-06-01 02:47:16 +08:00
|
|
|
|
|
|
|
// Reset insets
|
|
|
|
this->m_insetLeft = 0;
|
|
|
|
this->m_insetTop = 0;
|
|
|
|
this->m_insetRight = 0;
|
|
|
|
this->m_insetBottom = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
float CCScale9Sprite::getInsetLeft()
|
|
|
|
{
|
|
|
|
return this->m_insetLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
float CCScale9Sprite::getInsetTop()
|
|
|
|
{
|
|
|
|
return this->m_insetTop;
|
|
|
|
}
|
|
|
|
|
|
|
|
float CCScale9Sprite::getInsetRight()
|
|
|
|
{
|
|
|
|
return this->m_insetRight;
|
|
|
|
}
|
|
|
|
|
|
|
|
float CCScale9Sprite::getInsetBottom()
|
|
|
|
{
|
|
|
|
return this->m_insetBottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCScale9Sprite::setInsetLeft(float insetLeft)
|
|
|
|
{
|
|
|
|
this->m_insetLeft = insetLeft;
|
|
|
|
this->updateCapInset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCScale9Sprite::setInsetTop(float insetTop)
|
|
|
|
{
|
|
|
|
this->m_insetTop = insetTop;
|
|
|
|
this->updateCapInset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCScale9Sprite::setInsetRight(float insetRight)
|
|
|
|
{
|
|
|
|
this->m_insetRight = insetRight;
|
|
|
|
this->updateCapInset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCScale9Sprite::setInsetBottom(float insetBottom)
|
|
|
|
{
|
|
|
|
this->m_insetBottom = insetBottom;
|
|
|
|
this->updateCapInset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCScale9Sprite::visit()
|
|
|
|
{
|
|
|
|
if(this->m_positionsAreDirty)
|
|
|
|
{
|
|
|
|
this->updatePositions();
|
|
|
|
this->m_positionsAreDirty = false;
|
|
|
|
}
|
|
|
|
CCNode::visit();
|
|
|
|
}
|
|
|
|
|
2012-04-27 18:47:49 +08:00
|
|
|
NS_CC_EXT_END
|