mirror of https://github.com/axmolengine/axmol.git
not create Vec as possible for setting position
This commit is contained in:
parent
491c32b705
commit
9fb977ff99
|
@ -259,8 +259,8 @@ void Follow::step(float dt)
|
|||
|
||||
Vec2 tempPos = _halfScreenSize - _followedNode->getPosition();
|
||||
|
||||
_target->setPosition(Vec2(clampf(tempPos.x, _leftBoundary, _rightBoundary),
|
||||
clampf(tempPos.y, _bottomBoundary, _topBoundary)));
|
||||
_target->setPosition(clampf(tempPos.x, _leftBoundary, _rightBoundary),
|
||||
clampf(tempPos.y, _bottomBoundary, _topBoundary));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -836,8 +836,8 @@ void TMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
|
|||
{
|
||||
// put the anchor in the middle for ease of rotation.
|
||||
sprite->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
sprite->setPosition(Vec2(getPositionAt(pos).x + sprite->getContentSize().height/2,
|
||||
getPositionAt(pos).y + sprite->getContentSize().width/2 ) );
|
||||
sprite->setPosition(getPositionAt(pos).x + sprite->getContentSize().height/2,
|
||||
getPositionAt(pos).y + sprite->getContentSize().width/2 );
|
||||
|
||||
int flag = gid & (kTMXTileHorizontalFlag | kTMXTileVerticalFlag );
|
||||
|
||||
|
|
|
@ -1157,8 +1157,8 @@ Sprite * Label::getLetter(int letterIndex)
|
|||
|
||||
sp = Sprite::createWithTexture(_fontAtlas->getTexture(letter.def.textureID),uvRect);
|
||||
sp->setBatchNode(_batchNodes[letter.def.textureID]);
|
||||
sp->setPosition(Vec2(letter.position.x + uvRect.size.width / 2,
|
||||
letter.position.y - uvRect.size.height / 2));
|
||||
sp->setPosition(letter.position.x + uvRect.size.width / 2,
|
||||
letter.position.y - uvRect.size.height / 2);
|
||||
sp->setOpacity(_realOpacity);
|
||||
|
||||
_batchNodes[letter.def.textureID]->addSpriteWithoutQuad(sp, letter.atlasIndex, letterIndex);
|
||||
|
|
|
@ -141,7 +141,7 @@ bool Menu::initWithArray(const Vector<MenuItem*>& arrayOfItems)
|
|||
setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
this->setContentSize(s);
|
||||
|
||||
setPosition(Vec2(s.width/2, s.height/2));
|
||||
setPosition(s.width/2, s.height/2);
|
||||
|
||||
int z=0;
|
||||
|
||||
|
@ -321,7 +321,7 @@ void Menu::alignItemsVerticallyWithPadding(float padding)
|
|||
float y = height / 2.0f;
|
||||
|
||||
for(const auto &child : _children) {
|
||||
child->setPosition(Vec2(0, y - child->getContentSize().height * child->getScaleY() / 2.0f));
|
||||
child->setPosition(0, y - child->getContentSize().height * child->getScaleY() / 2.0f);
|
||||
y -= child->getContentSize().height * child->getScaleY() + padding;
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ void Menu::alignItemsHorizontallyWithPadding(float padding)
|
|||
float x = -width / 2.0f;
|
||||
|
||||
for(const auto &child : _children) {
|
||||
child->setPosition(Vec2(x + child->getContentSize().width * child->getScaleX() / 2.0f, 0));
|
||||
child->setPosition(x + child->getContentSize().width * child->getScaleX() / 2.0f, 0);
|
||||
x += child->getContentSize().width * child->getScaleX() + padding;
|
||||
}
|
||||
}
|
||||
|
@ -419,8 +419,8 @@ void Menu::alignItemsInColumnsWithArray(const ValueVector& rows)
|
|||
float tmp = child->getContentSize().height;
|
||||
rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp);
|
||||
|
||||
child->setPosition(Vec2(x - winSize.width / 2,
|
||||
y - child->getContentSize().height / 2));
|
||||
child->setPosition(x - winSize.width / 2,
|
||||
y - child->getContentSize().height / 2);
|
||||
|
||||
x += w;
|
||||
++columnsOccupied;
|
||||
|
@ -520,8 +520,8 @@ void Menu::alignItemsInRowsWithArray(const ValueVector& columns)
|
|||
float tmp = child->getContentSize().width;
|
||||
columnWidth = (unsigned int)((columnWidth >= tmp || isnan(tmp)) ? columnWidth : tmp);
|
||||
|
||||
child->setPosition(Vec2(x + columnWidths[column] / 2,
|
||||
y - winSize.height / 2));
|
||||
child->setPosition(x + columnWidths[column] / 2,
|
||||
y - winSize.height / 2);
|
||||
|
||||
y -= child->getContentSize().height + 10;
|
||||
++rowsOccupied;
|
||||
|
|
|
@ -948,7 +948,7 @@ void MenuItemToggle::setSelectedIndex(unsigned int index)
|
|||
this->addChild(item, 0, kCurrentItem);
|
||||
Size s = item->getContentSize();
|
||||
this->setContentSize(s);
|
||||
item->setPosition( Vec2( s.width/2, s.height/2 ) );
|
||||
item->setPosition(s.width/2, s.height/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -472,10 +472,23 @@ const Vec2& Node::getPosition() const
|
|||
/// position setter
|
||||
void Node::setPosition(const Vec2& position)
|
||||
{
|
||||
if (_position.equals(position))
|
||||
setPosition(position.x, position.y);
|
||||
}
|
||||
|
||||
void Node::getPosition(float* x, float* y) const
|
||||
{
|
||||
*x = _position.x;
|
||||
*y = _position.y;
|
||||
}
|
||||
|
||||
void Node::setPosition(float x, float y)
|
||||
{
|
||||
if (_position.x == x && _position.y == y)
|
||||
return;
|
||||
|
||||
_position = position;
|
||||
_position.x = x;
|
||||
_position.y = y;
|
||||
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
_usingNormalizedPosition = false;
|
||||
|
||||
|
@ -487,21 +500,10 @@ void Node::setPosition(const Vec2& position)
|
|||
#endif
|
||||
}
|
||||
|
||||
void Node::getPosition(float* x, float* y) const
|
||||
{
|
||||
*x = _position.x;
|
||||
*y = _position.y;
|
||||
}
|
||||
|
||||
void Node::setPosition(float x, float y)
|
||||
{
|
||||
setPosition(Vec2(x, y));
|
||||
}
|
||||
|
||||
void Node::setPosition3D(const Vec3& position)
|
||||
{
|
||||
_positionZ = position.z;
|
||||
setPosition(Vec2(position.x, position.y));
|
||||
setPositionZ(position.z);
|
||||
setPosition(position.x, position.y);
|
||||
}
|
||||
|
||||
Vec3 Node::getPosition3D() const
|
||||
|
@ -520,7 +522,7 @@ float Node::getPositionX() const
|
|||
|
||||
void Node::setPositionX(float x)
|
||||
{
|
||||
setPosition(Vec2(x, _position.y));
|
||||
setPosition(x, _position.y);
|
||||
}
|
||||
|
||||
float Node::getPositionY() const
|
||||
|
@ -530,7 +532,7 @@ float Node::getPositionY() const
|
|||
|
||||
void Node::setPositionY(float y)
|
||||
{
|
||||
setPosition(Vec2(_position.x, y));
|
||||
setPosition(_position.x, y);
|
||||
}
|
||||
|
||||
float Node::getPositionZ() const
|
||||
|
|
|
@ -290,7 +290,7 @@ public:
|
|||
* This code snippet sets the node in the center of screen.
|
||||
@code
|
||||
Size size = Director::getInstance()->getWinSize();
|
||||
node->setPosition( Vec2(size.width/2, size.height/2) )
|
||||
node->setPosition(size.width/2, size.height/2)
|
||||
@endcode
|
||||
*
|
||||
* @param position The position (x,y) of the node in OpenGL coordinates
|
||||
|
|
|
@ -165,7 +165,7 @@ void ParallaxNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32
|
|||
PointObject *point = (PointObject*)_parallaxArray->arr[i];
|
||||
float x = -pos.x + pos.x * point->getRatio().x + point->getOffset().x;
|
||||
float y = -pos.y + pos.y * point->getRatio().y + point->getOffset().y;
|
||||
point->getChild()->setPosition(Vec2(x,y));
|
||||
point->getChild()->setPosition(x,y);
|
||||
}
|
||||
_lastPosition = pos;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ bool ParticleFire::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, 60));
|
||||
this->setPosition(winSize.width/2, 60);
|
||||
this->_posVar = Vec2(40, 20);
|
||||
|
||||
// life of particles
|
||||
|
@ -216,7 +216,7 @@ bool ParticleFireworks::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height/2));
|
||||
this->setPosition(winSize.width/2, winSize.height/2);
|
||||
|
||||
// angle
|
||||
this->_angle= 90;
|
||||
|
@ -325,7 +325,7 @@ bool ParticleSun::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height/2));
|
||||
this->setPosition(winSize.width/2, winSize.height/2);
|
||||
setPosVar(Vec2::ZERO);
|
||||
|
||||
// life of particles
|
||||
|
@ -432,7 +432,7 @@ bool ParticleGalaxy::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height/2));
|
||||
this->setPosition(winSize.width/2, winSize.height/2);
|
||||
setPosVar(Vec2::ZERO);
|
||||
|
||||
// life of particles
|
||||
|
@ -541,7 +541,7 @@ bool ParticleFlower::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height/2));
|
||||
this->setPosition(winSize.width/2, winSize.height/2);
|
||||
setPosVar(Vec2::ZERO);
|
||||
|
||||
// life of particles
|
||||
|
@ -649,7 +649,7 @@ bool ParticleMeteor::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height/2));
|
||||
this->setPosition(winSize.width/2, winSize.height/2);
|
||||
setPosVar(Vec2::ZERO);
|
||||
|
||||
// life of particles
|
||||
|
@ -758,7 +758,7 @@ bool ParticleSpiral::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height/2));
|
||||
this->setPosition(winSize.width/2, winSize.height/2);
|
||||
setPosVar(Vec2::ZERO);
|
||||
|
||||
// life of particles
|
||||
|
@ -866,7 +866,7 @@ bool ParticleExplosion::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height/2));
|
||||
this->setPosition(winSize.width/2, winSize.height/2);
|
||||
setPosVar(Vec2::ZERO);
|
||||
|
||||
// life of particles
|
||||
|
@ -971,7 +971,7 @@ bool ParticleSmoke::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, 0));
|
||||
this->setPosition(winSize.width/2, 0);
|
||||
setPosVar(Vec2(20, 0));
|
||||
|
||||
// life of particles
|
||||
|
@ -1076,7 +1076,7 @@ bool ParticleSnow::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height + 10));
|
||||
this->setPosition(winSize.width/2, winSize.height + 10);
|
||||
setPosVar(Vec2(winSize.width/2, 0));
|
||||
|
||||
// angle
|
||||
|
@ -1188,7 +1188,7 @@ bool ParticleRain::initWithTotalParticles(int numberOfParticles)
|
|||
|
||||
// emitter position
|
||||
Size winSize = Director::getInstance()->getWinSize();
|
||||
this->setPosition(Vec2(winSize.width/2, winSize.height));
|
||||
this->setPosition(winSize.width/2, winSize.height);
|
||||
setPosVar(Vec2(winSize.width/2, 0));
|
||||
|
||||
// life of particles
|
||||
|
|
|
@ -257,7 +257,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string&
|
|||
// position
|
||||
float x = dictionary["sourcePositionx"].asFloat();
|
||||
float y = dictionary["sourcePositiony"].asFloat();
|
||||
this->setPosition( Vec2(x,y) );
|
||||
this->setPosition(x,y);
|
||||
_posVar.x = dictionary["sourcePositionVariancex"].asFloat();
|
||||
_posVar.y = dictionary["sourcePositionVariancey"].asFloat();
|
||||
|
||||
|
|
|
@ -243,8 +243,8 @@ void TMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
|
|||
{
|
||||
// put the anchor in the middle for ease of rotation.
|
||||
sprite->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
sprite->setPosition(Vec2(getPositionAt(pos).x + sprite->getContentSize().height/2,
|
||||
getPositionAt(pos).y + sprite->getContentSize().width/2 ) );
|
||||
sprite->setPosition(getPositionAt(pos).x + sprite->getContentSize().height/2,
|
||||
getPositionAt(pos).y + sprite->getContentSize().width/2 );
|
||||
|
||||
int flag = gid & (kTMXTileHorizontalFlag | kTMXTileVerticalFlag );
|
||||
|
||||
|
|
|
@ -121,13 +121,13 @@ void TransitionScene::finish()
|
|||
{
|
||||
// clean up
|
||||
_inScene->setVisible(true);
|
||||
_inScene->setPosition(Vec2(0,0));
|
||||
_inScene->setPosition(0,0);
|
||||
_inScene->setScale(1.0f);
|
||||
_inScene->setRotation(0.0f);
|
||||
_inScene->setAdditionalTransform(nullptr);
|
||||
|
||||
_outScene->setVisible(false);
|
||||
_outScene->setPosition(Vec2(0,0));
|
||||
_outScene->setPosition(0,0);
|
||||
_outScene->setScale(1.0f);
|
||||
_outScene->setRotation(0.0f);
|
||||
_outScene->setAdditionalTransform(nullptr);
|
||||
|
@ -311,7 +311,7 @@ void TransitionJumpZoom::onEnter()
|
|||
Size s = Director::getInstance()->getWinSize();
|
||||
|
||||
_inScene->setScale(0.5f);
|
||||
_inScene->setPosition(Vec2(s.width, 0));
|
||||
_inScene->setPosition(s.width, 0);
|
||||
_inScene->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
_outScene->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
|
||||
|
@ -392,7 +392,7 @@ ActionInterval* TransitionMoveInL::easeActionWithAction(ActionInterval* action)
|
|||
void TransitionMoveInL::initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition(Vec2(-s.width,0));
|
||||
_inScene->setPosition(-s.width,0);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -420,7 +420,7 @@ TransitionMoveInR* TransitionMoveInR::create(float t, Scene* scene)
|
|||
void TransitionMoveInR::initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition( Vec2(s.width,0) );
|
||||
_inScene->setPosition(s.width,0);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -448,7 +448,7 @@ TransitionMoveInT* TransitionMoveInT::create(float t, Scene* scene)
|
|||
void TransitionMoveInT::initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition( Vec2(0,s.height) );
|
||||
_inScene->setPosition(0,s.height);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -476,7 +476,7 @@ TransitionMoveInB* TransitionMoveInB::create(float t, Scene* scene)
|
|||
void TransitionMoveInB::initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition( Vec2(0,-s.height) );
|
||||
_inScene->setPosition(0,-s.height);
|
||||
}
|
||||
|
||||
|
||||
|
@ -524,7 +524,7 @@ void TransitionSlideInL::sceneOrder()
|
|||
void TransitionSlideInL:: initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition( Vec2(-(s.width-ADJUST_FACTOR),0) );
|
||||
_inScene->setPosition(-(s.width-ADJUST_FACTOR),0);
|
||||
}
|
||||
|
||||
ActionInterval* TransitionSlideInL::action()
|
||||
|
@ -580,7 +580,7 @@ void TransitionSlideInR::sceneOrder()
|
|||
void TransitionSlideInR::initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition( Vec2(s.width-ADJUST_FACTOR,0) );
|
||||
_inScene->setPosition(s.width-ADJUST_FACTOR,0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -621,7 +621,7 @@ void TransitionSlideInT::sceneOrder()
|
|||
void TransitionSlideInT::initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition( Vec2(0,s.height-ADJUST_FACTOR) );
|
||||
_inScene->setPosition(0,s.height-ADJUST_FACTOR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -661,7 +661,7 @@ void TransitionSlideInB::sceneOrder()
|
|||
void TransitionSlideInB:: initScenes()
|
||||
{
|
||||
Size s = Director::getInstance()->getWinSize();
|
||||
_inScene->setPosition( Vec2(0,-(s.height-ADJUST_FACTOR)) );
|
||||
_inScene->setPosition(0,-(s.height-ADJUST_FACTOR));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ void TransitionCrossFade::onEnter()
|
|||
}
|
||||
|
||||
inTexture->getSprite()->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
inTexture->setPosition( Vec2(size.width/2, size.height/2) );
|
||||
inTexture->setPosition(size.width/2, size.height/2);
|
||||
inTexture->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
|
||||
// render inScene to its texturebuffer
|
||||
|
@ -1297,7 +1297,7 @@ void TransitionCrossFade::onEnter()
|
|||
// create the second render texture for outScene
|
||||
RenderTexture* outTexture = RenderTexture::create((int)size.width, (int)size.height);
|
||||
outTexture->getSprite()->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
outTexture->setPosition( Vec2(size.width/2, size.height/2) );
|
||||
outTexture->setPosition(size.width/2, size.height/2);
|
||||
outTexture->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
|
||||
// render outScene to its texturebuffer
|
||||
|
|
|
@ -73,7 +73,7 @@ void TransitionProgress::onEnter()
|
|||
// create the second render texture for outScene
|
||||
RenderTexture *texture = RenderTexture::create((int)size.width, (int)size.height);
|
||||
texture->getSprite()->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
texture->setPosition(Vec2(size.width/2, size.height/2));
|
||||
texture->setPosition(size.width/2, size.height/2);
|
||||
texture->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
|
||||
// render outScene to its texturebuffer
|
||||
|
@ -144,7 +144,7 @@ ProgressTimer* TransitionProgressRadialCCW::progressTimerNodeWithRenderTexture(R
|
|||
// Return the radial type that we want to use
|
||||
node->setReverseDirection(false);
|
||||
node->setPercentage(100);
|
||||
node->setPosition(Vec2(size.width/2, size.height/2));
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
|
||||
return node;
|
||||
|
@ -188,7 +188,7 @@ ProgressTimer* TransitionProgressRadialCW::progressTimerNodeWithRenderTexture(Re
|
|||
// Return the radial type that we want to use
|
||||
node->setReverseDirection(true);
|
||||
node->setPercentage(100);
|
||||
node->setPosition(Vec2(size.width/2, size.height/2));
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
|
||||
return node;
|
||||
|
@ -221,7 +221,7 @@ ProgressTimer* TransitionProgressHorizontal::progressTimerNodeWithRenderTexture(
|
|||
node->setBarChangeRate(Vec2(1,0));
|
||||
|
||||
node->setPercentage(100);
|
||||
node->setPosition(Vec2(size.width/2, size.height/2));
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
|
||||
return node;
|
||||
|
@ -254,7 +254,7 @@ ProgressTimer* TransitionProgressVertical::progressTimerNodeWithRenderTexture(Re
|
|||
node->setBarChangeRate(Vec2(0,1));
|
||||
|
||||
node->setPercentage(100);
|
||||
node->setPosition(Vec2(size.width/2, size.height/2));
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
|
||||
return node;
|
||||
|
@ -300,7 +300,7 @@ ProgressTimer* TransitionProgressInOut::progressTimerNodeWithRenderTexture(Rende
|
|||
node->setBarChangeRate(Vec2(1, 1));
|
||||
|
||||
node->setPercentage(0);
|
||||
node->setPosition(Vec2(size.width/2, size.height/2));
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
|
||||
return node;
|
||||
|
@ -334,7 +334,7 @@ ProgressTimer* TransitionProgressOutIn::progressTimerNodeWithRenderTexture(Rende
|
|||
node->setBarChangeRate(Vec2(1, 1));
|
||||
|
||||
node->setPercentage(100);
|
||||
node->setPosition(Vec2(size.width/2, size.height/2));
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
|
||||
return node;
|
||||
|
|
|
@ -288,7 +288,7 @@ void NodeReader::initNode(Node* node, const rapidjson::Value& json)
|
|||
bool visible = DICTOOL->getBooleanValue_json(json, VISIBLE);
|
||||
|
||||
if(x != 0 || y != 0)
|
||||
node->setPosition(Point(x, y));
|
||||
node->setPosition(x, y);
|
||||
if(scalex != 1)
|
||||
node->setScaleX(scalex);
|
||||
if(scaley != 1)
|
||||
|
|
|
@ -165,7 +165,7 @@ bool ComRender::serialize(void* r)
|
|||
else if(strcmp(className, "CCParticleSystemQuad") == 0 && filePath.find(".plist") != filePath.npos)
|
||||
{
|
||||
_render = CCParticleSystemQuad::create(filePath.c_str());
|
||||
_render->setPosition(Point(0.0f, 0.0f));
|
||||
_render->setPosition(0.0f, 0.0f);
|
||||
_render->retain();
|
||||
|
||||
ret = true;
|
||||
|
|
|
@ -475,7 +475,7 @@ void SceneReader::setPropertyFromJsonDict(const rapidjson::Value &root, cocos2d:
|
|||
{
|
||||
float x = DICTOOL->getFloatValue_json(root, "x");
|
||||
float y = DICTOOL->getFloatValue_json(root, "y");
|
||||
node->setPosition(Vec2(x, y));
|
||||
node->setPosition(x, y);
|
||||
|
||||
const bool bVisible = (DICTOOL->getIntValue_json(root, "visible", 1) != 0);
|
||||
node->setVisible(bVisible);
|
||||
|
|
|
@ -128,7 +128,7 @@ void Skin::setSkinData(const BaseData &var)
|
|||
setScaleY(_skinData.scaleY);
|
||||
setRotationSkewX(CC_RADIANS_TO_DEGREES(_skinData.skewX));
|
||||
setRotationSkewY(CC_RADIANS_TO_DEGREES(-_skinData.skewY));
|
||||
setPosition(Vec2(_skinData.x, _skinData.y));
|
||||
setPosition(_skinData.x, _skinData.y);
|
||||
|
||||
_skinTransform = getNodeToParentTransform();
|
||||
updateArmatureTransform();
|
||||
|
|
|
@ -341,7 +341,7 @@ void PhysicsBody::setGravityEnable(bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
void PhysicsBody::setPosition(Vec2 position)
|
||||
void PhysicsBody::setPosition(const Vec2& position)
|
||||
{
|
||||
cpBodySetPos(_info->getBody(), PhysicsHelper::point2cpv(position + _positionOffset));
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ protected:
|
|||
|
||||
bool init();
|
||||
|
||||
virtual void setPosition(Vec2 position);
|
||||
virtual void setPosition(const Vec2& position);
|
||||
virtual void setRotation(float rotation);
|
||||
virtual void setScale(float scale);
|
||||
virtual void setScale(float scaleX, float scaleY);
|
||||
|
|
|
@ -439,7 +439,7 @@ void Button::updateFlippedY()
|
|||
|
||||
void Button::updateTitleLocation()
|
||||
{
|
||||
_titleRenderer->setPosition(Vec2(_contentSize.width * 0.5f, _contentSize.height * 0.5f));
|
||||
_titleRenderer->setPosition(_contentSize.width * 0.5f, _contentSize.height * 0.5f);
|
||||
}
|
||||
|
||||
void Button::onSizeChanged()
|
||||
|
|
|
@ -479,7 +479,7 @@ void CheckBox::backGroundTextureScaleChangedWithSize()
|
|||
_backGroundBoxRenderer->setScaleX(scaleX);
|
||||
_backGroundBoxRenderer->setScaleY(scaleY);
|
||||
}
|
||||
_backGroundBoxRenderer->setPosition(Vec2(_contentSize.width / 2, _contentSize.height / 2));
|
||||
_backGroundBoxRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||
}
|
||||
|
||||
void CheckBox::backGroundSelectedTextureScaleChangedWithSize()
|
||||
|
@ -501,7 +501,7 @@ void CheckBox::backGroundSelectedTextureScaleChangedWithSize()
|
|||
_backGroundSelectedBoxRenderer->setScaleX(scaleX);
|
||||
_backGroundSelectedBoxRenderer->setScaleY(scaleY);
|
||||
}
|
||||
_backGroundSelectedBoxRenderer->setPosition(Vec2(_contentSize.width / 2, _contentSize.height / 2));
|
||||
_backGroundSelectedBoxRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||
}
|
||||
|
||||
void CheckBox::frontCrossTextureScaleChangedWithSize()
|
||||
|
@ -523,7 +523,7 @@ void CheckBox::frontCrossTextureScaleChangedWithSize()
|
|||
_frontCrossRenderer->setScaleX(scaleX);
|
||||
_frontCrossRenderer->setScaleY(scaleY);
|
||||
}
|
||||
_frontCrossRenderer->setPosition(Vec2(_contentSize.width / 2, _contentSize.height / 2));
|
||||
_frontCrossRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||
}
|
||||
|
||||
void CheckBox::backGroundDisabledTextureScaleChangedWithSize()
|
||||
|
@ -545,7 +545,7 @@ void CheckBox::backGroundDisabledTextureScaleChangedWithSize()
|
|||
_backGroundBoxDisabledRenderer->setScaleX(scaleX);
|
||||
_backGroundBoxDisabledRenderer->setScaleY(scaleY);
|
||||
}
|
||||
_backGroundBoxDisabledRenderer->setPosition(Vec2(_contentSize.width / 2, _contentSize.height / 2));
|
||||
_backGroundBoxDisabledRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||
}
|
||||
|
||||
void CheckBox::frontCrossDisabledTextureScaleChangedWithSize()
|
||||
|
@ -567,7 +567,7 @@ void CheckBox::frontCrossDisabledTextureScaleChangedWithSize()
|
|||
_frontCrossDisabledRenderer->setScaleX(scaleX);
|
||||
_frontCrossDisabledRenderer->setScaleY(scaleY);
|
||||
}
|
||||
_frontCrossDisabledRenderer->setPosition(Vec2(_contentSize.width / 2, _contentSize.height / 2));
|
||||
_frontCrossDisabledRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||
}
|
||||
|
||||
std::string CheckBox::getDescription() const
|
||||
|
|
|
@ -574,7 +574,7 @@ void Layout::onSizeChanged()
|
|||
_clippingRectDirty = true;
|
||||
if (_backGroundImage)
|
||||
{
|
||||
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
|
||||
_backGroundImage->setPosition(_contentSize.width/2.0f, _contentSize.height/2.0f);
|
||||
if (_backGroundScale9Enabled && _backGroundImage)
|
||||
{
|
||||
_backGroundImage->setPreferredSize(_contentSize);
|
||||
|
@ -640,7 +640,7 @@ void Layout::setBackGroundImage(const std::string& fileName,TextureResType texTy
|
|||
}
|
||||
|
||||
_backGroundImageTextureSize = _backGroundImage->getContentSize();
|
||||
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
|
||||
_backGroundImage->setPosition(_contentSize.width/2.0f, _contentSize.height/2.0f);
|
||||
updateBackGroundImageRGBA();
|
||||
}
|
||||
|
||||
|
@ -699,7 +699,7 @@ void Layout::addBackGroundImage()
|
|||
|
||||
addProtectedChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
|
||||
|
||||
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
|
||||
_backGroundImage->setPosition(_contentSize.width/2.0f, _contentSize.height/2.0f);
|
||||
}
|
||||
|
||||
void Layout::removeBackGroundImage()
|
||||
|
|
|
@ -135,7 +135,7 @@ void LinearVerticalLayoutManager::doLayout(LayoutProtocol* layout)
|
|||
Margin mg = layoutParameter->getMargin();
|
||||
finalPosX += mg.left;
|
||||
finalPosY -= mg.top;
|
||||
subWidget->setPosition(Vec2(finalPosX, finalPosY));
|
||||
subWidget->setPosition(finalPosX, finalPosY);
|
||||
topBoundary = subWidget->getPosition().y - subWidget->getAnchorPoint().y * subWidget->getContentSize().height - mg.bottom;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,14 +100,14 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction)
|
|||
{
|
||||
case Direction::LEFT:
|
||||
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
|
||||
_barRenderer->setPosition(Vec2(0,0.0f));
|
||||
_barRenderer->setPosition(0,0.0f);
|
||||
if (!_scale9Enabled) {
|
||||
_barRenderer->setFlippedX(false);
|
||||
}
|
||||
break;
|
||||
case Direction::RIGHT:
|
||||
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
|
||||
_barRenderer->setPosition(Vec2(_totalLength,0.0f));
|
||||
_barRenderer->setPosition(_totalLength,0.0f);
|
||||
if (!_scale9Enabled) {
|
||||
_barRenderer->setFlippedX(true);
|
||||
}
|
||||
|
@ -310,10 +310,10 @@ void LoadingBar::barRendererScaleChangedWithSize()
|
|||
switch (_direction)
|
||||
{
|
||||
case Direction::LEFT:
|
||||
_barRenderer->setPosition(Vec2(0.0f, _contentSize.height / 2.0f));
|
||||
_barRenderer->setPosition(0.0f, _contentSize.height / 2.0f);
|
||||
break;
|
||||
case Direction::RIGHT:
|
||||
_barRenderer->setPosition(Vec2(_totalLength, _contentSize.height / 2.0f));
|
||||
_barRenderer->setPosition(_totalLength, _contentSize.height / 2.0f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -356,7 +356,7 @@ void RichText::formarRenderers()
|
|||
{
|
||||
Node* l = row->at(j);
|
||||
l->setAnchorPoint(Vec2::ZERO);
|
||||
l->setPosition(Vec2(nextPosX, 0.0f));
|
||||
l->setPosition(nextPosX, 0.0f);
|
||||
_elementRenderersContainer->addChild(l, 1);
|
||||
Size iSize = l->getContentSize();
|
||||
newContentSizeWidth += iSize.width;
|
||||
|
@ -395,7 +395,7 @@ void RichText::formarRenderers()
|
|||
{
|
||||
Node* l = row->at(j);
|
||||
l->setAnchorPoint(Vec2::ZERO);
|
||||
l->setPosition(Vec2(nextPosX, nextPosY));
|
||||
l->setPosition(nextPosX, nextPosY);
|
||||
_elementRenderersContainer->addChild(l, 1);
|
||||
nextPosX += l->getContentSize().width;
|
||||
}
|
||||
|
|
|
@ -431,23 +431,23 @@ y+=ytranslate; \
|
|||
_centre->setAnchorPoint(Vec2(0,0));
|
||||
|
||||
// Position corners
|
||||
_bottomLeft->setPosition(Vec2(0,0));
|
||||
_bottomRight->setPosition(Vec2(leftWidth+rescaledWidth,0));
|
||||
_topLeft->setPosition(Vec2(0, bottomHeight+rescaledHeight));
|
||||
_topRight->setPosition(Vec2(leftWidth+rescaledWidth, bottomHeight+rescaledHeight));
|
||||
_bottomLeft->setPosition(0,0);
|
||||
_bottomRight->setPosition(leftWidth+rescaledWidth,0);
|
||||
_topLeft->setPosition(0, bottomHeight+rescaledHeight);
|
||||
_topRight->setPosition(leftWidth+rescaledWidth, bottomHeight+rescaledHeight);
|
||||
|
||||
// Scale and position borders
|
||||
_left->setPosition(Vec2(0, bottomHeight));
|
||||
_left->setPosition(0, bottomHeight);
|
||||
_left->setScaleY(verticalScale);
|
||||
_right->setPosition(Vec2(leftWidth+rescaledWidth,bottomHeight));
|
||||
_right->setPosition(leftWidth+rescaledWidth,bottomHeight);
|
||||
_right->setScaleY(verticalScale);
|
||||
_bottom->setPosition(Vec2(leftWidth,0));
|
||||
_bottom->setPosition(leftWidth,0);
|
||||
_bottom->setScaleX(horizontalScale);
|
||||
_top->setPosition(Vec2(leftWidth,bottomHeight+rescaledHeight));
|
||||
_top->setPosition(leftWidth,bottomHeight+rescaledHeight);
|
||||
_top->setScaleX(horizontalScale);
|
||||
|
||||
// Position centre
|
||||
_centre->setPosition(Vec2(leftWidth, bottomHeight));
|
||||
_centre->setPosition(leftWidth, bottomHeight);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithFile(const std::string& file, const Rect& rect, const Rect& capInsets)
|
||||
|
@ -894,8 +894,8 @@ y+=ytranslate; \
|
|||
{
|
||||
if (_scale9Image)
|
||||
{
|
||||
_scale9Image->setPosition(Vec2(_contentSize.width * _scale9Image->getAnchorPoint().x,
|
||||
_contentSize.height * _scale9Image->getAnchorPoint().y));
|
||||
_scale9Image->setPosition(_contentSize.width * _scale9Image->getAnchorPoint().x,
|
||||
_contentSize.height * _scale9Image->getAnchorPoint().y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ void Slider::setPercent(int percent)
|
|||
_percent = percent;
|
||||
float res = percent / 100.0f;
|
||||
float dis = _barLength * res;
|
||||
_slidBallRenderer->setPosition(Vec2(dis, _contentSize.height / 2.0f));
|
||||
_slidBallRenderer->setPosition(dis, _contentSize.height / 2.0f);
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
_progressBarRenderer->setPreferredSize(Size(dis,_progressBarTextureSize.height));
|
||||
|
|
|
@ -509,14 +509,14 @@ void ControlButton::needsLayout()
|
|||
}
|
||||
if (_titleLabel != nullptr)
|
||||
{
|
||||
_titleLabel->setPosition(Vec2 (getContentSize().width / 2, getContentSize().height / 2));
|
||||
_titleLabel->setPosition(getContentSize().width / 2, getContentSize().height / 2);
|
||||
}
|
||||
|
||||
// Update the background sprite
|
||||
this->setBackgroundSprite(this->getBackgroundSpriteForState(_state));
|
||||
if (_backgroundSprite != nullptr)
|
||||
{
|
||||
_backgroundSprite->setPosition(Vec2 (getContentSize().width / 2, getContentSize().height / 2));
|
||||
_backgroundSprite->setPosition(getContentSize().width / 2, getContentSize().height / 2);
|
||||
}
|
||||
|
||||
// Get the title label size
|
||||
|
@ -571,14 +571,14 @@ void ControlButton::needsLayout()
|
|||
|
||||
if (_titleLabel != nullptr)
|
||||
{
|
||||
_titleLabel->setPosition(Vec2(getContentSize().width/2, getContentSize().height/2));
|
||||
_titleLabel->setPosition(getContentSize().width/2, getContentSize().height/2);
|
||||
// Make visible the background and the label
|
||||
_titleLabel->setVisible(true);
|
||||
}
|
||||
|
||||
if (_backgroundSprite != nullptr)
|
||||
{
|
||||
_backgroundSprite->setPosition(Vec2(getContentSize().width/2, getContentSize().height/2));
|
||||
_backgroundSprite->setPosition(getContentSize().width/2, getContentSize().height/2);
|
||||
_backgroundSprite->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ bool ControlHuePicker::initWithTargetAndPos(Node* target, Vec2 pos)
|
|||
this->setBackground(ControlUtils::addSpriteToTargetWithPosAndAnchor("huePickerBackground.png", target, pos, Vec2(0.0f, 0.0f)));
|
||||
this->setSlider(ControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, Vec2(0.5f, 0.5f)));
|
||||
|
||||
_slider->setPosition(Vec2(pos.x, pos.y + _background->getBoundingBox().size.height * 0.5f));
|
||||
_slider->setPosition(pos.x, pos.y + _background->getBoundingBox().size.height * 0.5f);
|
||||
_startPos=pos;
|
||||
|
||||
// Sets the default value
|
||||
|
@ -111,7 +111,7 @@ void ControlHuePicker::setHuePercentage(float hueValueInPercent)
|
|||
// Set new position of the slider
|
||||
float x = centerX + limit * cosf(angle);
|
||||
float y = centerY + limit * sinf(angle);
|
||||
_slider->setPosition(Vec2(x, y));
|
||||
_slider->setPosition(x, y);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -136,19 +136,19 @@ bool ControlSlider::initWithSprites(Sprite * backgroundSprite, Sprite* progressS
|
|||
|
||||
// Add the slider background
|
||||
_backgroundSprite->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
_backgroundSprite->setPosition(Vec2(this->getContentSize().width / 2, this->getContentSize().height / 2));
|
||||
_backgroundSprite->setPosition(this->getContentSize().width / 2, this->getContentSize().height / 2);
|
||||
addChild(_backgroundSprite);
|
||||
|
||||
// Add the progress bar
|
||||
_progressSprite->setAnchorPoint(Vec2(0.0f, 0.5f));
|
||||
_progressSprite->setPosition(Vec2(0.0f, this->getContentSize().height / 2));
|
||||
_progressSprite->setPosition(0.0f, this->getContentSize().height / 2);
|
||||
addChild(_progressSprite);
|
||||
|
||||
// Add the slider thumb
|
||||
_thumbSprite->setPosition(Vec2(0.0f, this->getContentSize().height / 2));
|
||||
_thumbSprite->setPosition(0.0f, this->getContentSize().height / 2);
|
||||
addChild(_thumbSprite);
|
||||
|
||||
_selectedThumbSprite->setPosition(Vec2(0.0f, this->getContentSize().height / 2));
|
||||
_selectedThumbSprite->setPosition(0.0f, this->getContentSize().height / 2);
|
||||
_selectedThumbSprite->setVisible(false);
|
||||
addChild(_selectedThumbSprite);
|
||||
|
||||
|
|
|
@ -86,25 +86,25 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite *minusSprite, Sprit
|
|||
|
||||
// Add the minus components
|
||||
this->setMinusSprite(minusSprite);
|
||||
_minusSprite->setPosition( Vec2(minusSprite->getContentSize().width / 2, minusSprite->getContentSize().height / 2) );
|
||||
_minusSprite->setPosition(minusSprite->getContentSize().width / 2, minusSprite->getContentSize().height / 2);
|
||||
this->addChild(_minusSprite);
|
||||
|
||||
this->setMinusLabel( Label::createWithSystemFont("-", ControlStepperLabelFont, 40));
|
||||
_minusLabel->setColor(ControlStepperLabelColorDisabled);
|
||||
_minusLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_minusLabel->setPosition(Vec2(_minusSprite->getContentSize().width / 2, _minusSprite->getContentSize().height / 2) );
|
||||
_minusLabel->setPosition(_minusSprite->getContentSize().width / 2, _minusSprite->getContentSize().height / 2);
|
||||
_minusSprite->addChild(_minusLabel);
|
||||
|
||||
// Add the plus components
|
||||
this->setPlusSprite( plusSprite );
|
||||
_plusSprite->setPosition( Vec2(minusSprite->getContentSize().width + plusSprite->getContentSize().width / 2,
|
||||
minusSprite->getContentSize().height / 2) );
|
||||
_plusSprite->setPosition(minusSprite->getContentSize().width + plusSprite->getContentSize().width / 2,
|
||||
minusSprite->getContentSize().height / 2);
|
||||
this->addChild(_plusSprite);
|
||||
|
||||
this->setPlusLabel( Label::createWithSystemFont("+", ControlStepperLabelFont, 40 ));
|
||||
_plusLabel->setColor( ControlStepperLabelColorEnabled );
|
||||
_plusLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_plusLabel->setPosition( Vec2(_plusSprite->getContentSize().width / 2, _plusSprite->getContentSize().height / 2) );
|
||||
_plusLabel->setPosition(_plusSprite->getContentSize().width / 2, _plusSprite->getContentSize().height / 2);
|
||||
_plusSprite->addChild(_plusLabel);
|
||||
|
||||
// Defines the content size
|
||||
|
|
|
@ -218,27 +218,27 @@ void ControlSwitchSprite::updateTweenAction(float value, const std::string& key)
|
|||
|
||||
void ControlSwitchSprite::needsLayout()
|
||||
{
|
||||
_onSprite->setPosition(Vec2(_onSprite->getContentSize().width / 2 + _sliderXPosition,
|
||||
_onSprite->getContentSize().height / 2));
|
||||
_offSprite->setPosition(Vec2(_onSprite->getContentSize().width + _offSprite->getContentSize().width / 2 + _sliderXPosition,
|
||||
_offSprite->getContentSize().height / 2));
|
||||
_thumbSprite->setPosition(Vec2(_onSprite->getContentSize().width + _sliderXPosition,
|
||||
_maskTexture->getContentSize().height / 2));
|
||||
_onSprite->setPosition(_onSprite->getContentSize().width / 2 + _sliderXPosition,
|
||||
_onSprite->getContentSize().height / 2);
|
||||
_offSprite->setPosition(_onSprite->getContentSize().width + _offSprite->getContentSize().width / 2 + _sliderXPosition,
|
||||
_offSprite->getContentSize().height / 2);
|
||||
_thumbSprite->setPosition(_onSprite->getContentSize().width + _sliderXPosition,
|
||||
_maskTexture->getContentSize().height / 2);
|
||||
|
||||
_clipperStencil->setPosition(Vec2(_maskTexture->getContentSize().width/2,
|
||||
_maskTexture->getContentSize().height / 2));
|
||||
_clipperStencil->setPosition(_maskTexture->getContentSize().width/2,
|
||||
_maskTexture->getContentSize().height / 2);
|
||||
|
||||
if (_onLabel)
|
||||
{
|
||||
_onLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_onLabel->setPosition(Vec2(_onSprite->getPosition().x - _thumbSprite->getContentSize().width / 6,
|
||||
_onSprite->getContentSize().height / 2));
|
||||
_onLabel->setPosition(_onSprite->getPosition().x - _thumbSprite->getContentSize().width / 6,
|
||||
_onSprite->getContentSize().height / 2);
|
||||
}
|
||||
if (_offLabel)
|
||||
{
|
||||
_offLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_offLabel->setPosition(Vec2(_offSprite->getPosition().x + _thumbSprite->getContentSize().width / 6,
|
||||
_offSprite->getContentSize().height / 2));
|
||||
_offLabel->setPosition(_offSprite->getPosition().x + _thumbSprite->getContentSize().width / 6,
|
||||
_offSprite->getContentSize().height / 2);
|
||||
}
|
||||
|
||||
setFlippedY(true);
|
||||
|
@ -326,7 +326,7 @@ bool ControlSwitch::initWithMaskSprite(Sprite *maskSprite, Sprite * onSprite, Sp
|
|||
onLabel,
|
||||
offLabel);
|
||||
_switchSprite->retain();
|
||||
_switchSprite->setPosition(Vec2(_switchSprite->getContentSize().width / 2, _switchSprite->getContentSize().height / 2));
|
||||
_switchSprite->setPosition(_switchSprite->getContentSize().width / 2, _switchSprite->getContentSize().height / 2);
|
||||
addChild(_switchSprite);
|
||||
|
||||
ignoreAnchorPointForPosition(false);
|
||||
|
|
|
@ -425,23 +425,23 @@ void Scale9Sprite::updatePositions()
|
|||
_centre->setAnchorPoint(Vec2(0,0));
|
||||
|
||||
// Position corners
|
||||
_bottomLeft->setPosition(Vec2(0,0));
|
||||
_bottomRight->setPosition(Vec2(leftWidth+rescaledWidth,0));
|
||||
_topLeft->setPosition(Vec2(0, bottomHeight+rescaledHeight));
|
||||
_topRight->setPosition(Vec2(leftWidth+rescaledWidth, bottomHeight+rescaledHeight));
|
||||
_bottomLeft->setPosition(0,0);
|
||||
_bottomRight->setPosition(leftWidth+rescaledWidth,0);
|
||||
_topLeft->setPosition(0, bottomHeight+rescaledHeight);
|
||||
_topRight->setPosition(leftWidth+rescaledWidth, bottomHeight+rescaledHeight);
|
||||
|
||||
// Scale and position borders
|
||||
_left->setPosition(Vec2(0, bottomHeight));
|
||||
_left->setPosition(0, bottomHeight);
|
||||
_left->setScaleY(verticalScale);
|
||||
_right->setPosition(Vec2(leftWidth+rescaledWidth,bottomHeight));
|
||||
_right->setPosition(leftWidth+rescaledWidth,bottomHeight);
|
||||
_right->setScaleY(verticalScale);
|
||||
_bottom->setPosition(Vec2(leftWidth,0));
|
||||
_bottom->setPosition(leftWidth,0);
|
||||
_bottom->setScaleX(horizontalScale);
|
||||
_top->setPosition(Vec2(leftWidth,bottomHeight+rescaledHeight));
|
||||
_top->setPosition(leftWidth,bottomHeight+rescaledHeight);
|
||||
_top->setScaleX(horizontalScale);
|
||||
|
||||
// Position centre
|
||||
_centre->setPosition(Vec2(leftWidth, bottomHeight));
|
||||
_centre->setPosition(leftWidth, bottomHeight);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithFile(const std::string& file, const Rect& rect, const Rect& capInsets)
|
||||
|
|
|
@ -80,7 +80,7 @@ bool EditBoxImplAndroid::initWithSize(const Size& size)
|
|||
_labelPlaceHolder->setSystemFontSize(size.height-12);
|
||||
// align the text vertically center
|
||||
_labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f));
|
||||
_labelPlaceHolder->setPosition(Vec2(CC_EDIT_BOX_PADDING, size.height / 2.0f));
|
||||
_labelPlaceHolder->setPosition(CC_EDIT_BOX_PADDING, size.height / 2.0f);
|
||||
_labelPlaceHolder->setVisible(false);
|
||||
_labelPlaceHolder->setColor(_colPlaceHolder);
|
||||
_editBox->addChild(_labelPlaceHolder);
|
||||
|
|
|
@ -340,8 +340,8 @@ void EditBoxImplIOS::initInactiveLabels(const Size& size)
|
|||
|
||||
void EditBoxImplIOS::placeInactiveLabels()
|
||||
{
|
||||
_label->setPosition(Vec2(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f));
|
||||
_labelPlaceHolder->setPosition(Vec2(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f));
|
||||
_label->setPosition(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f);
|
||||
_labelPlaceHolder->setPosition(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f);
|
||||
}
|
||||
|
||||
void EditBoxImplIOS::setInactiveText(const char* pText)
|
||||
|
|
|
@ -73,7 +73,7 @@ bool EditBoxImplWin::initWithSize(const Size& size)
|
|||
_labelPlaceHolder->setSystemFontSize(size.height-12);
|
||||
// align the text vertically center
|
||||
_labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f));
|
||||
_labelPlaceHolder->setPosition(Vec2(5, size.height / 2.0f));
|
||||
_labelPlaceHolder->setPosition(5, size.height / 2.0f);
|
||||
_labelPlaceHolder->setVisible(false);
|
||||
_labelPlaceHolder->setColor(_colPlaceHolder);
|
||||
_editBox->addChild(_labelPlaceHolder);
|
||||
|
|
|
@ -126,7 +126,7 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = nullptr*/)
|
|||
_clippingToBounds = true;
|
||||
//_container->setContentSize(Size::ZERO);
|
||||
_direction = Direction::BOTH;
|
||||
_container->setPosition(Vec2(0.0f, 0.0f));
|
||||
_container->setPosition(0.0f, 0.0f);
|
||||
_touchLength = 0.0f;
|
||||
|
||||
this->addChild(_container);
|
||||
|
|
|
@ -58,8 +58,8 @@ bool HelloWorld::init()
|
|||
auto label = LabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE);
|
||||
|
||||
// position the label on the center of the screen
|
||||
label->setPosition(Vec2(origin.x + visibleSize.width/2,
|
||||
origin.y + visibleSize.height - label->getContentSize().height));
|
||||
label->setPosition(origin.x + visibleSize.width/2,
|
||||
origin.y + visibleSize.height - label->getContentSize().height);
|
||||
|
||||
// add the label as a child to this layer
|
||||
this->addChild(label, 1);
|
||||
|
|
|
@ -200,7 +200,7 @@ void PauseTest::onEnter()
|
|||
|
||||
auto l = Label::createWithTTF("After 5 seconds grossini should move", "fonts/Thonburi.ttf", 16.0f);
|
||||
addChild(l);
|
||||
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y-75) );
|
||||
l->setPosition(VisibleRect::center().x, VisibleRect::top().y-75);
|
||||
|
||||
|
||||
//
|
||||
|
@ -242,7 +242,7 @@ void StopActionTest::onEnter()
|
|||
|
||||
auto l = Label::createWithTTF("Should not crash", "fonts/Thonburi.ttf", 16.0f);
|
||||
addChild(l);
|
||||
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 75) );
|
||||
l->setPosition(VisibleRect::center().x, VisibleRect::top().y - 75);
|
||||
|
||||
auto pMove = MoveBy::create(2, Vec2(200, 0));
|
||||
auto pCallback = CallFunc::create(CC_CALLBACK_0(StopActionTest::stopAction,this));
|
||||
|
@ -283,7 +283,7 @@ void ResumeTest::onEnter()
|
|||
|
||||
auto l = Label::createWithTTF("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16.0f);
|
||||
addChild(l);
|
||||
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 75));
|
||||
l->setPosition(VisibleRect::center().x, VisibleRect::top().y - 75);
|
||||
|
||||
auto pGrossini = Sprite::create(s_pathGrossini);
|
||||
addChild(pGrossini, 0, kTagGrossini);
|
||||
|
|
|
@ -55,19 +55,19 @@ void EaseSpriteDemo::centerSprites(unsigned int numberOfSprites)
|
|||
{
|
||||
_tamara->setVisible(false);
|
||||
_kathia->setVisible(false);
|
||||
_grossini->setPosition(Vec2(s.width/2, s.height/2));
|
||||
_grossini->setPosition(s.width/2, s.height/2);
|
||||
}
|
||||
else if( numberOfSprites == 2 )
|
||||
{
|
||||
_kathia->setPosition( Vec2(s.width/3, s.height/2));
|
||||
_tamara->setPosition( Vec2(2*s.width/3, s.height/2));
|
||||
_kathia->setPosition(s.width/3, s.height/2);
|
||||
_tamara->setPosition(2*s.width/3, s.height/2);
|
||||
_grossini->setVisible(false);
|
||||
}
|
||||
else if( numberOfSprites == 3 )
|
||||
{
|
||||
_grossini->setPosition( Vec2(s.width/2, s.height/2));
|
||||
_tamara->setPosition( Vec2(s.width/4, s.height/2));
|
||||
_kathia->setPosition( Vec2(3 * s.width/4, s.height/2));
|
||||
_grossini->setPosition(s.width/2, s.height/2);
|
||||
_tamara->setPosition(s.width/4, s.height/2);
|
||||
_kathia->setPosition(3 * s.width/4, s.height/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,7 +550,7 @@ void SpriteEaseBezier::onEnter()
|
|||
|
||||
|
||||
// sprite 2
|
||||
_tamara->setPosition(Vec2(80,160));
|
||||
_tamara->setPosition(80,160));
|
||||
ccBezierConfig bezier2;
|
||||
bezier2.controlPoint_1 = Vec2(100, s.height/2);
|
||||
bezier2.controlPoint_2 = Vec2(200, -s.height/2);
|
||||
|
@ -561,7 +561,7 @@ void SpriteEaseBezier::onEnter()
|
|||
bezierEaseTo1->setBezierParamer(0.5, 0.5, 1.0, 1.0);
|
||||
|
||||
// sprite 3
|
||||
_kathia->setPosition(Vec2(400,160));
|
||||
_kathia->setPosition(400,160);
|
||||
auto bezierTo2 = BezierTo::create(2, bezier2);
|
||||
auto bezierEaseTo2 = EaseBezierAction::create(bezierTo2);
|
||||
bezierEaseTo2->setBezierParamer(0.0, 0.5, -5.0, 1.0);
|
||||
|
@ -1066,8 +1066,8 @@ EaseSpriteDemo::~EaseSpriteDemo(void)
|
|||
|
||||
void EaseSpriteDemo::positionForTwo()
|
||||
{
|
||||
_grossini->setPosition(Vec2(VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*1/5));
|
||||
_tamara->setPosition(Vec2( VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*4/5));
|
||||
_grossini->setPosition(VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*1/5);
|
||||
_tamara->setPosition(VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*4/5);
|
||||
_kathia->setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -1090,9 +1090,9 @@ void EaseSpriteDemo::onEnter()
|
|||
addChild( _kathia, 2);
|
||||
addChild( _tamara, 1);
|
||||
|
||||
_grossini->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*1/5));
|
||||
_kathia->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2.5f/5));
|
||||
_tamara->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*4/5));
|
||||
_grossini->setPosition(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*1/5);
|
||||
_kathia->setPosition(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2.5f/5);
|
||||
_tamara->setPosition(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*4/5);
|
||||
}
|
||||
|
||||
void EaseSpriteDemo::restartCallback(Ref* sender)
|
||||
|
|
|
@ -163,7 +163,7 @@ void SpriteProgressToRadial::onEnter()
|
|||
auto left = ProgressTimer::create(Sprite::create(s_pathSister1));
|
||||
left->setType( ProgressTimer::Type::RADIAL );
|
||||
addChild(left);
|
||||
left->setPosition(Vec2(100, s.height/2));
|
||||
left->setPosition(100, s.height/2);
|
||||
left->runAction( RepeatForever::create(to1));
|
||||
|
||||
auto right = ProgressTimer::create(Sprite::create(s_pathBlock));
|
||||
|
@ -171,7 +171,7 @@ void SpriteProgressToRadial::onEnter()
|
|||
// Makes the ridial CCW
|
||||
right->setReverseProgress(true);
|
||||
addChild(right);
|
||||
right->setPosition(Vec2(s.width-100, s.height/2));
|
||||
right->setPosition(s.width-100, s.height/2);
|
||||
right->runAction( RepeatForever::create(to2));
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ void SpriteProgressToHorizontal::onEnter()
|
|||
// Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
|
||||
left->setBarChangeRate(Vec2(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(Vec2(100, s.height/2));
|
||||
left->setPosition(100, s.height/2);
|
||||
left->runAction( RepeatForever::create(to1));
|
||||
|
||||
auto right = ProgressTimer::create(Sprite::create(s_pathSister2));
|
||||
|
@ -212,7 +212,7 @@ void SpriteProgressToHorizontal::onEnter()
|
|||
// Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
|
||||
right->setBarChangeRate(Vec2(1, 0));
|
||||
addChild(right);
|
||||
right->setPosition(Vec2(s.width-100, s.height/2));
|
||||
right->setPosition(s.width-100, s.height/2);
|
||||
right->runAction( RepeatForever::create(to2));
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ void SpriteProgressToVertical::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left->setBarChangeRate(Vec2(0, 1));
|
||||
addChild(left);
|
||||
left->setPosition(Vec2(100, s.height/2));
|
||||
left->setPosition(100, s.height/2);
|
||||
left->runAction( RepeatForever::create(to1));
|
||||
|
||||
auto right = ProgressTimer::create(Sprite::create(s_pathSister2));
|
||||
|
@ -253,7 +253,7 @@ void SpriteProgressToVertical::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right->setBarChangeRate(Vec2(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(Vec2(s.width-100, s.height/2));
|
||||
right->setPosition(s.width-100, s.height/2);
|
||||
right->runAction( RepeatForever::create(to2));
|
||||
}
|
||||
|
||||
|
@ -281,8 +281,8 @@ void SpriteProgressToRadialMidpointChanged::onEnter()
|
|||
auto left = ProgressTimer::create(Sprite::create(s_pathBlock));
|
||||
left->setType(ProgressTimer::Type::RADIAL);
|
||||
addChild(left);
|
||||
left->setMidpoint(Vec2(0.25f, 0.75f));
|
||||
left->setPosition(Vec2(100, s.height/2));
|
||||
left->setMidpoint(0.25f, 0.75f);
|
||||
left->setPosition(100, s.height/2);
|
||||
left->runAction(RepeatForever::create(action->clone()));
|
||||
|
||||
/**
|
||||
|
@ -290,14 +290,14 @@ void SpriteProgressToRadialMidpointChanged::onEnter()
|
|||
*/
|
||||
auto right = ProgressTimer::create(Sprite::create(s_pathBlock));
|
||||
right->setType(ProgressTimer::Type::RADIAL);
|
||||
right->setMidpoint(Vec2(0.75f, 0.25f));
|
||||
right->setMidpoint(0.75f, 0.25f);
|
||||
|
||||
/**
|
||||
* Note the reverse property (default=NO) is only added to the right image. That's how
|
||||
* we get a counter clockwise progress.
|
||||
*/
|
||||
addChild(right);
|
||||
right->setPosition(Vec2(s.width-100, s.height/2));
|
||||
right->setPosition(s.width-100, s.height/2);
|
||||
right->runAction(RepeatForever::create(action->clone()));
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ void SpriteProgressBarVarious::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left->setBarChangeRate(Vec2(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(Vec2(100, s.height/2));
|
||||
left->setPosition(100, s.height/2);
|
||||
left->runAction(RepeatForever::create(to->clone()));
|
||||
|
||||
auto middle = ProgressTimer::create(Sprite::create(s_pathSister2));
|
||||
|
@ -337,7 +337,7 @@ void SpriteProgressBarVarious::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
middle->setBarChangeRate(Vec2(1,1));
|
||||
addChild(middle);
|
||||
middle->setPosition(Vec2(s.width/2, s.height/2));
|
||||
middle->setPosition(s.width/2, s.height/2);
|
||||
middle->runAction(RepeatForever::create(to->clone()));
|
||||
|
||||
auto right = ProgressTimer::create(Sprite::create(s_pathSister2));
|
||||
|
@ -347,7 +347,7 @@ void SpriteProgressBarVarious::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right->setBarChangeRate(Vec2(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(Vec2(s.width-100, s.height/2));
|
||||
right->setPosition(s.width-100, s.height/2);
|
||||
right->runAction(RepeatForever::create(to->clone()));
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left->setBarChangeRate(Vec2(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(Vec2(100, s.height/2));
|
||||
left->setPosition(100, s.height/2);
|
||||
left->runAction(RepeatForever::create(to->clone()));
|
||||
left->runAction(RepeatForever::create(tint->clone()));
|
||||
|
||||
|
@ -397,7 +397,7 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
middle->setBarChangeRate(Vec2(1, 1));
|
||||
addChild(middle);
|
||||
middle->setPosition(Vec2(s.width/2, s.height/2));
|
||||
middle->setPosition(s.width/2, s.height/2);
|
||||
middle->runAction(RepeatForever::create(to->clone()));
|
||||
middle->runAction(RepeatForever::create(fade->clone()));
|
||||
|
||||
|
@ -410,7 +410,7 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right->setBarChangeRate(Vec2(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(Vec2(s.width-100, s.height/2));
|
||||
right->setPosition(s.width-100, s.height/2);
|
||||
right->runAction(RepeatForever::create(to->clone()));
|
||||
right->runAction(RepeatForever::create(tint->clone()));
|
||||
right->runAction(RepeatForever::create(fade->clone()));
|
||||
|
@ -445,7 +445,7 @@ void SpriteProgressWithSpriteFrame::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left->setBarChangeRate(Vec2(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(Vec2(100, s.height/2));
|
||||
left->setPosition(100, s.height/2);
|
||||
left->runAction(RepeatForever::create(to->clone()));
|
||||
|
||||
auto middle = ProgressTimer::create(Sprite::createWithSpriteFrameName("grossini_dance_02.png"));
|
||||
|
@ -455,7 +455,7 @@ void SpriteProgressWithSpriteFrame::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
middle->setBarChangeRate(Vec2(1, 1));
|
||||
addChild(middle);
|
||||
middle->setPosition(Vec2(s.width/2, s.height/2));
|
||||
middle->setPosition(s.width/2, s.height/2);
|
||||
middle->runAction(RepeatForever::create(to->clone()));
|
||||
|
||||
auto right = ProgressTimer::create(Sprite::createWithSpriteFrameName("grossini_dance_03.png"));
|
||||
|
@ -465,7 +465,7 @@ void SpriteProgressWithSpriteFrame::onEnter()
|
|||
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right->setBarChangeRate(Vec2(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(Vec2(s.width-100, s.height/2));
|
||||
right->setPosition(s.width-100, s.height/2);
|
||||
right->runAction(RepeatForever::create(to->clone()));
|
||||
}
|
||||
|
||||
|
|
|
@ -151,9 +151,9 @@ void ActionsDemo::onEnter()
|
|||
addChild(_tamara, 2);
|
||||
addChild(_kathia, 3);
|
||||
|
||||
_grossini->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/3));
|
||||
_tamara->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2/3));
|
||||
_kathia->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/2));
|
||||
_grossini->setPosition(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/3);
|
||||
_tamara->setPosition(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2/3);
|
||||
_kathia->setPosition(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/2);
|
||||
}
|
||||
|
||||
void ActionsDemo::onExit()
|
||||
|
@ -203,19 +203,19 @@ void ActionsDemo::centerSprites(unsigned int numberOfSprites)
|
|||
{
|
||||
_tamara->setVisible(false);
|
||||
_kathia->setVisible(false);
|
||||
_grossini->setPosition(Vec2(s.width/2, s.height/2));
|
||||
_grossini->setPosition(s.width/2, s.height/2);
|
||||
}
|
||||
else if( numberOfSprites == 2 )
|
||||
{
|
||||
_kathia->setPosition( Vec2(s.width/3, s.height/2));
|
||||
_tamara->setPosition( Vec2(2*s.width/3, s.height/2));
|
||||
_kathia->setPosition(s.width/3, s.height/2);
|
||||
_tamara->setPosition(2*s.width/3, s.height/2);
|
||||
_grossini->setVisible(false);
|
||||
}
|
||||
else if( numberOfSprites == 3 )
|
||||
{
|
||||
_grossini->setPosition( Vec2(s.width/2, s.height/2));
|
||||
_tamara->setPosition( Vec2(s.width/4, s.height/2));
|
||||
_kathia->setPosition( Vec2(3 * s.width/4, s.height/2));
|
||||
_grossini->setPosition(s.width/2, s.height/2);
|
||||
_tamara->setPosition(s.width/4, s.height/2);
|
||||
_kathia->setPosition(3 * s.width/4, s.height/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,19 +227,19 @@ void ActionsDemo::alignSpritesLeft(unsigned int numberOfSprites)
|
|||
{
|
||||
_tamara->setVisible(false);
|
||||
_kathia->setVisible(false);
|
||||
_grossini->setPosition(Vec2(60, s.height/2));
|
||||
_grossini->setPosition(60, s.height/2);
|
||||
}
|
||||
else if( numberOfSprites == 2 )
|
||||
{
|
||||
_kathia->setPosition( Vec2(60, s.height/3));
|
||||
_tamara->setPosition( Vec2(60, 2*s.height/3));
|
||||
_kathia->setPosition(60, s.height/3);
|
||||
_tamara->setPosition(60, 2*s.height/3);
|
||||
_grossini->setVisible( false );
|
||||
}
|
||||
else if( numberOfSprites == 3 )
|
||||
{
|
||||
_grossini->setPosition( Vec2(60, s.height/2));
|
||||
_tamara->setPosition( Vec2(60, 2*s.height/3));
|
||||
_kathia->setPosition( Vec2(60, s.height/3));
|
||||
_grossini->setPosition(60, s.height/2);
|
||||
_tamara->setPosition(60, 2*s.height/3);
|
||||
_kathia->setPosition(60, s.height/3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,14 +256,14 @@ void ActionManual::onEnter()
|
|||
|
||||
_tamara->setScaleX( 2.5f);
|
||||
_tamara->setScaleY( -1.0f);
|
||||
_tamara->setPosition( Vec2(100,70) );
|
||||
_tamara->setPosition(100,70);
|
||||
_tamara->setOpacity( 128);
|
||||
|
||||
_grossini->setRotation( 120);
|
||||
_grossini->setPosition( Vec2(s.width/2, s.height/2));
|
||||
_grossini->setPosition(s.width/2, s.height/2);
|
||||
_grossini->setColor( Color3B( 255,0,0));
|
||||
|
||||
_kathia->setPosition( Vec2(s.width-100, s.height/2));
|
||||
_kathia->setPosition(s.width-100, s.height/2);
|
||||
_kathia->setColor( Color3B::BLUE);
|
||||
}
|
||||
|
||||
|
@ -396,11 +396,11 @@ void ActionRotationalSkewVSStandardSkew::onEnter()
|
|||
box->setAnchorPoint(Vec2(0.5,0.5));
|
||||
box->setContentSize( boxSize );
|
||||
box->ignoreAnchorPointForPosition(false);
|
||||
box->setPosition(Vec2(s.width/2, s.height - 100 - box->getContentSize().height/2));
|
||||
box->setPosition(s.width/2, s.height - 100 - box->getContentSize().height/2);
|
||||
this->addChild(box);
|
||||
|
||||
auto label = Label::createWithTTF("Standard cocos2d Skew", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2(s.width/2, s.height - 100 + label->getContentSize().height));
|
||||
label->setPosition(s.width/2, s.height - 100 + label->getContentSize().height);
|
||||
this->addChild(label);
|
||||
|
||||
auto actionTo = SkewBy::create(2, 360, 0);
|
||||
|
@ -412,11 +412,11 @@ void ActionRotationalSkewVSStandardSkew::onEnter()
|
|||
box->setAnchorPoint(Vec2(0.5,0.5));
|
||||
box->setContentSize(boxSize);
|
||||
box->ignoreAnchorPointForPosition(false);
|
||||
box->setPosition(Vec2(s.width/2, s.height - 250 - box->getContentSize().height/2));
|
||||
box->setPosition(s.width/2, s.height - 250 - box->getContentSize().height/2);
|
||||
this->addChild(box);
|
||||
|
||||
label = Label::createWithTTF("Rotational Skew", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2(s.width/2, s.height - 250 + label->getContentSize().height/2));
|
||||
label->setPosition(s.width/2, s.height - 250 + label->getContentSize().height/2);
|
||||
this->addChild(label);
|
||||
auto actionTo2 = RotateBy::create(2, 360, 0);
|
||||
auto actionToBack2 = RotateBy::create(2, -360, 0);
|
||||
|
@ -440,20 +440,20 @@ void ActionSkewRotateScale::onEnter()
|
|||
|
||||
auto box = LayerColor::create(Color4B(255, 255, 0, 255));
|
||||
box->setAnchorPoint(Vec2(0, 0));
|
||||
box->setPosition(Vec2(190, 110));
|
||||
box->setPosition(190, 110);
|
||||
box->setContentSize(boxSize);
|
||||
|
||||
static float markrside = 10.0f;
|
||||
auto uL = LayerColor::create(Color4B(255, 0, 0, 255));
|
||||
box->addChild(uL);
|
||||
uL->setContentSize(Size(markrside, markrside));
|
||||
uL->setPosition(Vec2(0.f, boxSize.height - markrside));
|
||||
uL->setPosition(0.f, boxSize.height - markrside);
|
||||
uL->setAnchorPoint(Vec2(0, 0));
|
||||
|
||||
auto uR = LayerColor::create(Color4B(0, 0, 255, 255));
|
||||
box->addChild(uR);
|
||||
uR->setContentSize(Size(markrside, markrside));
|
||||
uR->setPosition(Vec2(boxSize.width - markrside, boxSize.height - markrside));
|
||||
uR->setPosition(boxSize.width - markrside, boxSize.height - markrside);
|
||||
uR->setAnchorPoint(Vec2(0, 0));
|
||||
addChild(box);
|
||||
|
||||
|
@ -583,7 +583,7 @@ void ActionBezier::onEnter()
|
|||
|
||||
|
||||
// sprite 2
|
||||
_tamara->setPosition(Vec2(80,160));
|
||||
_tamara->setPosition(80,160);
|
||||
ccBezierConfig bezier2;
|
||||
bezier2.controlPoint_1 = Vec2(100, s.height/2);
|
||||
bezier2.controlPoint_2 = Vec2(200, -s.height/2);
|
||||
|
@ -592,7 +592,7 @@ void ActionBezier::onEnter()
|
|||
auto bezierTo1 = BezierTo::create(2, bezier2);
|
||||
|
||||
// sprite 3
|
||||
_kathia->setPosition(Vec2(400,160));
|
||||
_kathia->setPosition(400,160);
|
||||
auto bezierTo2 = BezierTo::create(2, bezier2);
|
||||
|
||||
_grossini->runAction( rep);
|
||||
|
@ -813,7 +813,7 @@ void ActionSequence2::callback1()
|
|||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 1 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2( s.width/4*1,s.height/2));
|
||||
label->setPosition(s.width/4*1,s.height/2);
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ void ActionSequence2::callback2(Node* sender)
|
|||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 2 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2( s.width/4*2,s.height/2));
|
||||
label->setPosition(s.width/4*2,s.height/2);
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ void ActionSequence2::callback3(Node* sender, long data)
|
|||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2( s.width/4*3,s.height/2));
|
||||
label->setPosition(s.width/4*3,s.height/2);
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -964,7 +964,7 @@ void ActionCallFunction::onEnter()
|
|||
[&](){
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("called:lambda callback", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2( s.width/4*1,s.height/2-40));
|
||||
label->setPosition(s.width/4*1,s.height/2-40);
|
||||
this->addChild(label);
|
||||
} ),
|
||||
nullptr);
|
||||
|
@ -991,7 +991,7 @@ void ActionCallFunction::callback1()
|
|||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 1 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2( s.width/4*1,s.height/2));
|
||||
label->setPosition(s.width/4*1,s.height/2);
|
||||
|
||||
addChild(label);
|
||||
}
|
||||
|
@ -1000,7 +1000,7 @@ void ActionCallFunction::callback2(Node* sender)
|
|||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 2 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2( s.width/4*2,s.height/2));
|
||||
label->setPosition(s.width/4*2,s.height/2);
|
||||
|
||||
addChild(label);
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ void ActionCallFunction::callback3(Node* sender, long data)
|
|||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Vec2( s.width/4*3,s.height/2));
|
||||
label->setPosition(s.width/4*3,s.height/2);
|
||||
addChild(label);
|
||||
|
||||
CCLOG("target is: %p, data is: %ld", sender, data);
|
||||
|
@ -1339,7 +1339,7 @@ void ActionFollow::onEnter()
|
|||
centerSprites(1);
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
_grossini->setPosition(Vec2(-200, s.height / 2));
|
||||
_grossini->setPosition(-200, s.height / 2);
|
||||
auto move = MoveBy::create(2, Vec2(s.width * 3, 0));
|
||||
auto move_back = move->reverse();
|
||||
auto seq = Sequence::create(move, move_back, nullptr);
|
||||
|
@ -1597,7 +1597,7 @@ void ActionCatmullRomStacked::onEnter()
|
|||
// is relative to the Catmull Rom curve, it is better to start with (0,0).
|
||||
//
|
||||
|
||||
_tamara->setPosition(Vec2(50,50));
|
||||
_tamara->setPosition(50,50);
|
||||
|
||||
auto array = PointArray::create(20);
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ void ActionCardinalSplineStacked::onEnter()
|
|||
|
||||
auto seq = Sequence::create(action, reverse, nullptr);
|
||||
|
||||
_tamara->setPosition(Vec2(50,50));
|
||||
_tamara->setPosition(50,50);
|
||||
_tamara->runAction(seq);
|
||||
|
||||
_tamara->runAction(
|
||||
|
@ -1764,7 +1764,7 @@ void ActionCardinalSplineStacked::onEnter()
|
|||
|
||||
auto seq2 = Sequence::create(action2, reverse2, nullptr);
|
||||
|
||||
_kathia->setPosition(Vec2(s.width/2,50));
|
||||
_kathia->setPosition(s.width/2,50);
|
||||
|
||||
_kathia->runAction(seq2);
|
||||
|
||||
|
@ -1875,7 +1875,7 @@ void Issue1305::onExit()
|
|||
|
||||
void Issue1305::addSprite(float dt)
|
||||
{
|
||||
_spriteTmp->setPosition(Vec2(250,250));
|
||||
_spriteTmp->setPosition(250,250);
|
||||
addChild(_spriteTmp);
|
||||
}
|
||||
|
||||
|
@ -1895,7 +1895,7 @@ void Issue1305_2::onEnter()
|
|||
centerSprites(0);
|
||||
|
||||
auto spr = Sprite::create("Images/grossini.png");
|
||||
spr->setPosition(Vec2(200,200));
|
||||
spr->setPosition(200,200);
|
||||
addChild(spr);
|
||||
|
||||
auto act1 = MoveBy::create(2 ,Vec2(0, 100));
|
||||
|
@ -1968,7 +1968,7 @@ void Issue1288::onEnter()
|
|||
centerSprites(0);
|
||||
|
||||
auto spr = Sprite::create("Images/grossini.png");
|
||||
spr->setPosition(Vec2(100, 100));
|
||||
spr->setPosition(100, 100);
|
||||
addChild(spr);
|
||||
|
||||
auto act1 = MoveBy::create(0.5, Vec2(100, 0));
|
||||
|
@ -1995,7 +1995,7 @@ void Issue1288_2::onEnter()
|
|||
centerSprites(0);
|
||||
|
||||
auto spr = Sprite::create("Images/grossini.png");
|
||||
spr->setPosition(Vec2(100, 100));
|
||||
spr->setPosition(100, 100);
|
||||
addChild(spr);
|
||||
|
||||
auto act1 = MoveBy::create(0.5, Vec2(100, 0));
|
||||
|
@ -2019,7 +2019,7 @@ void Issue1327::onEnter()
|
|||
centerSprites(0);
|
||||
|
||||
auto spr = Sprite::create("Images/grossini.png");
|
||||
spr->setPosition(Vec2(100, 100));
|
||||
spr->setPosition(100, 100);
|
||||
addChild(spr);
|
||||
|
||||
auto act1 = CallFunc::create( std::bind(&Issue1327::logSprRotation, this, spr));
|
||||
|
@ -2144,7 +2144,7 @@ void ActionCatmullRom::onEnter()
|
|||
// is relative to the Catmull Rom curve, it is better to start with (0,0).
|
||||
//
|
||||
|
||||
_tamara->setPosition(Vec2(50, 50));
|
||||
_tamara->setPosition(50, 50);
|
||||
|
||||
auto array = PointArray::create(20);
|
||||
|
||||
|
@ -2277,7 +2277,7 @@ void ActionCardinalSpline::onEnter()
|
|||
|
||||
auto seq = Sequence::create(action, reverse, nullptr);
|
||||
|
||||
_tamara->setPosition(Vec2(50, 50));
|
||||
_tamara->setPosition(50, 50);
|
||||
_tamara->runAction(seq);
|
||||
|
||||
//
|
||||
|
@ -2291,7 +2291,7 @@ void ActionCardinalSpline::onEnter()
|
|||
|
||||
auto seq2 = Sequence::create(action2, reverse2, nullptr);
|
||||
|
||||
_kathia->setPosition(Vec2(s.width/2, 50));
|
||||
_kathia->setPosition(s.width/2, 50);
|
||||
_kathia->runAction(seq2);
|
||||
|
||||
_array = array;
|
||||
|
|
|
@ -40,7 +40,7 @@ void BaseTest::onEnter()
|
|||
TTFConfig ttfConfig("fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithTTF(ttfConfig,pTitle);
|
||||
addChild(label, 9999);
|
||||
label->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
label->setPosition(VisibleRect::center().x, VisibleRect::top().y - 30);
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
|
@ -49,7 +49,7 @@ void BaseTest::onEnter()
|
|||
ttfConfig.fontSize = 16;
|
||||
auto l = Label::createWithTTF(ttfConfig,strSubtitle.c_str());
|
||||
addChild(l, 9999);
|
||||
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
l->setPosition(VisibleRect::center().x, VisibleRect::top().y - 60);
|
||||
}
|
||||
|
||||
// add menu
|
||||
|
@ -61,9 +61,9 @@ void BaseTest::onEnter()
|
|||
auto menu = Menu::create(item1, item2, item3, nullptr);
|
||||
|
||||
menu->setPosition(Vec2::ZERO);
|
||||
item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(Vec2(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item1->setPosition(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
item2->setPosition(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
item3->setPosition(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
|
||||
addChild(menu, 9999);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ Box2DTestLayer::Box2DTestLayer()
|
|||
auto label = Label::createWithTTF("Tap screen", "fonts/Marker Felt.ttf", 32.0f);
|
||||
addChild(label, 0);
|
||||
label->setColor(Color3B(0,0,255));
|
||||
label->setPosition(Vec2( VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
label->setPosition(VisibleRect::center().x, VisibleRect::top().y-50);
|
||||
|
||||
scheduleUpdate();
|
||||
#else
|
||||
|
@ -54,7 +54,7 @@ Box2DTestLayer::Box2DTestLayer()
|
|||
"fonts/arial.ttf",
|
||||
18);
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
label->setPosition(Vec2(size.width/2, size.height/2));
|
||||
label->setPosition(size.width/2, size.height/2);
|
||||
|
||||
addChild(label);
|
||||
#endif
|
||||
|
@ -132,7 +132,7 @@ void Box2DTestLayer::createResetButton()
|
|||
|
||||
auto menu = Menu::create(reset, nullptr);
|
||||
|
||||
menu->setPosition(Vec2(VisibleRect::bottom().x, VisibleRect::bottom().y + 30));
|
||||
menu->setPosition(VisibleRect::bottom().x, VisibleRect::bottom().y + 30);
|
||||
this->addChild(menu, -1);
|
||||
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ void Box2DTestLayer::addNewSpriteAtPosition(Vec2 p)
|
|||
parent->addChild(sprite);
|
||||
sprite->setB2Body(body);
|
||||
sprite->setPTMRatio(PTM_RATIO);
|
||||
sprite->setPosition( Vec2( p.x, p.y) );
|
||||
sprite->setPosition(p.x, p.y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ bool MenuLayer::initWithEntryID(int entryId)
|
|||
addChild(view, 0, kTagBox2DNode);
|
||||
view->setScale(15);
|
||||
view->setAnchorPoint( Vec2(0,0) );
|
||||
view->setPosition( Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/3) );
|
||||
view->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/3);
|
||||
auto label = Label::createWithTTF(view->title().c_str(), "fonts/arial.ttf", 28);
|
||||
addChild(label, 1);
|
||||
label->setPosition( Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height-50) );
|
||||
label->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height-50);
|
||||
|
||||
auto item1 = MenuItemImage::create("Images/b1.png", "Images/b2.png", CC_CALLBACK_1(MenuLayer::backCallback, this) );
|
||||
auto item2 = MenuItemImage::create("Images/r1.png","Images/r2.png", CC_CALLBACK_1( MenuLayer::restartCallback, this) );
|
||||
|
@ -70,9 +70,9 @@ bool MenuLayer::initWithEntryID(int entryId)
|
|||
auto menu = Menu::create(item1, item2, item3, nullptr);
|
||||
|
||||
menu->setPosition( Vec2::ZERO );
|
||||
item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(Vec2(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item1->setPosition(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
item2->setPosition(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
item3->setPosition(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
|
||||
addChild(menu, 1);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ bool Bug1159Layer::init()
|
|||
auto sprite_a = LayerColor::create(Color4B(255, 0, 0, 255), 700, 700);
|
||||
sprite_a->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
sprite_a->ignoreAnchorPointForPosition(false);
|
||||
sprite_a->setPosition(Vec2(0.0f, s.height/2));
|
||||
sprite_a->setPosition(0.0f, s.height/2);
|
||||
addChild(sprite_a);
|
||||
|
||||
sprite_a->runAction(RepeatForever::create(Sequence::create(
|
||||
|
@ -42,12 +42,12 @@ bool Bug1159Layer::init()
|
|||
auto sprite_b = LayerColor::create(Color4B(0, 0, 255, 255), 400, 400);
|
||||
sprite_b->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
sprite_b->ignoreAnchorPointForPosition(false);
|
||||
sprite_b->setPosition(Vec2(s.width/2, s.height/2));
|
||||
sprite_b->setPosition(s.width/2, s.height/2);
|
||||
addChild(sprite_b);
|
||||
|
||||
auto label = MenuItemLabel::create(Label::createWithSystemFont("Flip Me", "Helvetica", 24), CC_CALLBACK_1(Bug1159Layer::callBack, this) );
|
||||
auto menu = Menu::create(label, nullptr);
|
||||
menu->setPosition(Vec2(s.width - 200.0f, 50.0f));
|
||||
menu->setPosition(s.width - 200.0f, 50.0f);
|
||||
addChild(menu);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -11,7 +11,7 @@ bool Bug350Layer::init()
|
|||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
auto background = Sprite::create("Hello.png");
|
||||
background->setPosition(Vec2(size.width/2, size.height/2));
|
||||
background->setPosition(size.width/2, size.height/2);
|
||||
addChild(background);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ bool Bug458Layer::init()
|
|||
auto sprite2 = MenuItemSprite::create(layer, layer2, CC_CALLBACK_1(Bug458Layer::selectAnswer, this) );
|
||||
auto menu = Menu::create(sprite, sprite2, nullptr);
|
||||
menu->alignItemsVerticallyWithPadding(100);
|
||||
menu->setPosition(Vec2(size.width / 2, size.height / 2));
|
||||
menu->setPosition(size.width / 2, size.height / 2);
|
||||
|
||||
// add the label as a child to this Layer
|
||||
addChild(menu);
|
||||
|
|
|
@ -22,7 +22,7 @@ bool Bug624Layer::init()
|
|||
auto size = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("Layer1", "fonts/Marker Felt.ttf", 36.0f);
|
||||
|
||||
label->setPosition(Vec2(size.width/2, size.height/2));
|
||||
label->setPosition(size.width/2, size.height/2);
|
||||
addChild(label);
|
||||
|
||||
Device::setAccelerometerEnabled(true);
|
||||
|
@ -68,7 +68,7 @@ bool Bug624Layer2::init()
|
|||
auto size = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("Layer2", "fonts/Marker Felt.ttf", 36.0f);
|
||||
|
||||
label->setPosition(Vec2(size.width/2, size.height/2));
|
||||
label->setPosition(size.width/2, size.height/2);
|
||||
addChild(label);
|
||||
|
||||
Device::setAccelerometerEnabled(true);
|
||||
|
|
|
@ -21,7 +21,7 @@ bool Bug886Layer::init()
|
|||
auto sprite2 = Sprite::create("Images/bugs/bug886.png");
|
||||
sprite2->setAnchorPoint(Vec2::ZERO);
|
||||
sprite2->setScaleX(0.6f);
|
||||
sprite2->setPosition(Vec2(sprite->getContentSize().width * 0.6f + 10, 0));
|
||||
sprite2->setPosition(sprite->getContentSize().width * 0.6f + 10, 0);
|
||||
addChild(sprite2);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -42,7 +42,7 @@ bool Bug914Layer::init()
|
|||
{
|
||||
layer = LayerColor::create(Color4B(i*20, i*20, i*20,255));
|
||||
layer->setContentSize(Size(i*100, i*100));
|
||||
layer->setPosition(Vec2(size.width/2, size.height/2));
|
||||
layer->setPosition(size.width/2, size.height/2);
|
||||
layer->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
layer->ignoreAnchorPointForPosition(false);
|
||||
addChild(layer, -1-i);
|
||||
|
@ -54,11 +54,11 @@ bool Bug914Layer::init()
|
|||
|
||||
auto menu = Menu::create(item1, nullptr);
|
||||
menu->alignItemsVertically();
|
||||
menu->setPosition(Vec2(size.width/2, 100));
|
||||
menu->setPosition(size.width/2, 100);
|
||||
addChild(menu);
|
||||
|
||||
// position the label on the center of the screen
|
||||
label->setPosition(Vec2( size.width /2 , size.height/2 ));
|
||||
label->setPosition(size.width /2 , size.height/2);
|
||||
|
||||
// add the label as a child to this Layer
|
||||
addChild(label);
|
||||
|
|
|
@ -63,7 +63,7 @@ void BugsTestMainLayer::onEnter()
|
|||
for (int i = 0; i < g_maxitems; ++i)
|
||||
{
|
||||
auto pItem = MenuItemFont::create(g_bugs[i].test_name, g_bugs[i].callback);
|
||||
pItem->setPosition(Vec2(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
pItem->setPosition(s.width / 2, s.height - (i + 1) * LINE_SPACE);
|
||||
_itmeMenu->addChild(pItem, kItemTagBasic + i);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ void BugsTestMainLayer::onTouchesMoved(const std::vector<Touch*>& touches, Event
|
|||
|
||||
if (nextPos.y > ((g_maxitems + 1)* LINE_SPACE - winSize.height))
|
||||
{
|
||||
_itmeMenu->setPosition(Vec2(0, ((g_maxitems + 1)* LINE_SPACE - winSize.height)));
|
||||
_itmeMenu->setPosition(0, ((g_maxitems + 1)* LINE_SPACE - winSize.height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ void BugsTestBaseLayer::onEnter()
|
|||
MenuItemFont::setFontName("fonts/arial.ttf");
|
||||
MenuItemFont::setFontSize(24);
|
||||
auto pMainItem = MenuItemFont::create("Back", CC_CALLBACK_1(BugsTestBaseLayer::backCallback, this));
|
||||
pMainItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
pMainItem->setPosition(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25);
|
||||
auto menu = Menu::create(pMainItem, nullptr);
|
||||
menu->setPosition( Vec2::ZERO );
|
||||
addChild(menu);
|
||||
|
|
|
@ -284,13 +284,13 @@ void Camera3DTestDemo::onEnter()
|
|||
auto menu = Menu::create(menuItem1,menuItem2,menuItem3,menuItem4,menuItem5,menuItem6,menuItem7,NULL);
|
||||
|
||||
menu->setPosition(Vec2::ZERO);
|
||||
menuItem1->setPosition( Vec2( s.width-50, VisibleRect::top().y-50 ) );
|
||||
menuItem2->setPosition( Vec2( s.width-50, VisibleRect::top().y-100) );
|
||||
menuItem3->setPosition( Vec2( s.width-50, VisibleRect::top().y-150) );
|
||||
menuItem4->setPosition( Vec2( s.width-50, VisibleRect::top().y-200) );
|
||||
menuItem5->setPosition( Vec2(VisibleRect::left().x+100, VisibleRect::top().y-50) );
|
||||
menuItem6->setPosition( Vec2(VisibleRect::left().x+100, VisibleRect::top().y -100));
|
||||
menuItem7->setPosition( Vec2(VisibleRect::left().x+100, VisibleRect::top().y -150));
|
||||
menuItem1->setPosition(s.width-50, VisibleRect::top().y-50 );
|
||||
menuItem2->setPosition(s.width-50, VisibleRect::top().y-100);
|
||||
menuItem3->setPosition(s.width-50, VisibleRect::top().y-150);
|
||||
menuItem4->setPosition(s.width-50, VisibleRect::top().y-200);
|
||||
menuItem5->setPosition(VisibleRect::left().x+100, VisibleRect::top().y-50);
|
||||
menuItem6->setPosition(VisibleRect::left().x+100, VisibleRect::top().y -100);
|
||||
menuItem7->setPosition(VisibleRect::left().x+100, VisibleRect::top().y -150);
|
||||
addChild(menu, 0);
|
||||
schedule(schedule_selector(Camera3DTestDemo::updateCamera), 0.0f);
|
||||
if (_camera == nullptr)
|
||||
|
|
|
@ -32,7 +32,7 @@ ChipmunkTestLayer::ChipmunkTestLayer()
|
|||
|
||||
// title
|
||||
auto label = Label::createWithTTF("Multi touch the screen", "fonts/Marker Felt.ttf", 36.0f);
|
||||
label->setPosition(cocos2d::Vec2( VisibleRect::center().x, VisibleRect::top().y - 30));
|
||||
label->setPosition(VisibleRect::center().x, VisibleRect::top().y - 30);
|
||||
this->addChild(label, -1);
|
||||
|
||||
// reset button
|
||||
|
@ -60,7 +60,7 @@ ChipmunkTestLayer::ChipmunkTestLayer()
|
|||
|
||||
auto menu = Menu::create(item, nullptr);
|
||||
this->addChild(menu);
|
||||
menu->setPosition(cocos2d::Vec2(VisibleRect::right().x-100, VisibleRect::top().y-60));
|
||||
menu->setPosition(VisibleRect::right().x-100, VisibleRect::top().y-60);
|
||||
|
||||
scheduleUpdate();
|
||||
#else
|
||||
|
@ -68,7 +68,7 @@ ChipmunkTestLayer::ChipmunkTestLayer()
|
|||
"fonts/arial.ttf",
|
||||
18);
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
label->setPosition(Vec2(size.width/2, size.height/2));
|
||||
label->setPosition(size.width/2, size.height/2);
|
||||
|
||||
addChild(label);
|
||||
|
||||
|
@ -160,7 +160,7 @@ void ChipmunkTestLayer::createResetButton()
|
|||
|
||||
auto menu = Menu::create(reset, nullptr);
|
||||
|
||||
menu->setPosition(cocos2d::Vec2(VisibleRect::center().x, VisibleRect::bottom().y + 30));
|
||||
menu->setPosition(VisibleRect::center().x, VisibleRect::bottom().y + 30);
|
||||
this->addChild(menu, -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ MainLayer::MainLayer()
|
|||
addChild(layer, -1);
|
||||
|
||||
addChild(sprite, 0, kTagSprite);
|
||||
sprite->setPosition( Vec2(20,150) );
|
||||
sprite->setPosition(20,150);
|
||||
|
||||
sprite->runAction( JumpTo::create(4, Vec2(300,48), 100, 4) );
|
||||
|
||||
|
|
|
@ -148,17 +148,17 @@ void BasicTest::setup()
|
|||
|
||||
auto stencil = this->stencil();
|
||||
stencil->setTag( kTagStencilNode );
|
||||
stencil->setPosition( Vec2(50, 50) );
|
||||
stencil->setPosition(50, 50);
|
||||
|
||||
auto clipper = this->clipper();
|
||||
clipper->setTag( kTagClipperNode );
|
||||
clipper->setAnchorPoint(Vec2(0.5, 0.5));
|
||||
clipper->setPosition( Vec2(s.width / 2 - 50, s.height / 2 - 50) );
|
||||
clipper->setPosition(s.width / 2 - 50, s.height / 2 - 50);
|
||||
clipper->setStencil(stencil);
|
||||
this->addChild(clipper);
|
||||
|
||||
auto content = this->content();
|
||||
content->setPosition( Vec2(50, 50) );
|
||||
content->setPosition(50, 50);
|
||||
clipper->addChild(content);
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ void NestedTest::setup()
|
|||
auto clipper = ClippingNode::create();
|
||||
clipper->setContentSize(Size(size, size));
|
||||
clipper->setAnchorPoint(Vec2(0.5, 0.5));
|
||||
clipper->setPosition( Vec2(parent->getContentSize().width / 2, parent->getContentSize().height / 2) );
|
||||
clipper->setPosition(parent->getContentSize().width / 2, parent->getContentSize().height / 2);
|
||||
clipper->setAlphaThreshold(0.05f);
|
||||
clipper->runAction(RepeatForever::create(RotateBy::create(i % 3 ? 1.33 : 1.66, i % 2 ? 90 : -90)));
|
||||
parent->addChild(clipper);
|
||||
|
@ -360,7 +360,7 @@ void NestedTest::setup()
|
|||
auto stencil = Sprite::create(s_pathGrossini);
|
||||
stencil->setScale( 2.5 - (i * (2.5 / depth)) );
|
||||
stencil->setAnchorPoint( Vec2(0.5, 0.5) );
|
||||
stencil->setPosition( Vec2(clipper->getContentSize().width / 2, clipper->getContentSize().height / 2) );
|
||||
stencil->setPosition(clipper->getContentSize().width / 2, clipper->getContentSize().height / 2);
|
||||
stencil->setVisible(false);
|
||||
stencil->runAction(Sequence::createWithTwoActions(DelayTime::create(i), Show::create()));
|
||||
clipper->setStencil(stencil);
|
||||
|
@ -485,7 +485,7 @@ void ScrollViewDemo::setup()
|
|||
clipper->setTag( kTagClipperNode );
|
||||
clipper->setContentSize( Size(200, 200) );
|
||||
clipper->setAnchorPoint( Vec2(0.5, 0.5) );
|
||||
clipper->setPosition( Vec2(this->getContentSize().width / 2, this->getContentSize().height / 2) );
|
||||
clipper->setPosition(this->getContentSize().width / 2, this->getContentSize().height / 2);
|
||||
clipper->runAction(RepeatForever::create(RotateBy::create(1, 45)));
|
||||
this->addChild(clipper);
|
||||
|
||||
|
@ -503,7 +503,7 @@ void ScrollViewDemo::setup()
|
|||
auto content = Sprite::create(s_back2);
|
||||
content->setTag( kTagContentNode );
|
||||
content->setAnchorPoint( Vec2(0.5, 0.5) );
|
||||
content->setPosition( Vec2(clipper->getContentSize().width / 2, clipper->getContentSize().height / 2) );
|
||||
content->setPosition(clipper->getContentSize().width / 2, clipper->getContentSize().height / 2);
|
||||
clipper->addChild(content);
|
||||
|
||||
_scrolling = false;
|
||||
|
@ -840,7 +840,7 @@ void RawStencilBufferTest6::setup()
|
|||
glFlush();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &bits);
|
||||
auto clearToZeroLabel = Label::createWithTTF(String::createWithFormat("00=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20);
|
||||
clearToZeroLabel->setPosition( Vec2((winPoint.x / 3) * 1, winPoint.y - 10) );
|
||||
clearToZeroLabel->setPosition((winPoint.x / 3) * 1, winPoint.y - 10);
|
||||
this->addChild(clearToZeroLabel);
|
||||
glStencilMask(0x0F);
|
||||
glClearStencil(0xAA);
|
||||
|
@ -848,7 +848,7 @@ void RawStencilBufferTest6::setup()
|
|||
glFlush();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &bits);
|
||||
auto clearToMaskLabel = Label::createWithTTF(String::createWithFormat("0a=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20);
|
||||
clearToMaskLabel->setPosition( Vec2((winPoint.x / 3) * 2, winPoint.y - 10) );
|
||||
clearToMaskLabel->setPosition((winPoint.x / 3) * 2, winPoint.y - 10);
|
||||
this->addChild(clearToMaskLabel);
|
||||
#endif
|
||||
glStencilMask(~0);
|
||||
|
|
|
@ -174,9 +174,9 @@ public:
|
|||
_lblMinValue = Label::createWithTTF(buffer, "fonts/arial.ttf", 8);
|
||||
addChild(_lblMinValue);
|
||||
if (_direction == Vertical)
|
||||
_lblMinValue->setPosition(Vec2(12.0, -50.0));
|
||||
_lblMinValue->setPosition(12.0, -50.0);
|
||||
else
|
||||
_lblMinValue->setPosition(Vec2(-50, 12.0));
|
||||
_lblMinValue->setPosition(-50, 12.0);
|
||||
} else {
|
||||
_lblMinValue->setString(buffer);
|
||||
}
|
||||
|
@ -186,9 +186,9 @@ public:
|
|||
_lblMaxValue = Label::createWithTTF(buffer, "fonts/arial.ttf", 8);
|
||||
addChild(_lblMaxValue);
|
||||
if (_direction == Vertical)
|
||||
_lblMaxValue->setPosition(Vec2(12.0, 50.0));
|
||||
_lblMaxValue->setPosition(12.0, 50.0);
|
||||
else
|
||||
_lblMaxValue->setPosition(Vec2(50, 12.0));
|
||||
_lblMaxValue->setPosition(50, 12.0);
|
||||
} else {
|
||||
_lblMaxValue->setString(buffer);
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ void CocosDenshionTest::addSliders()
|
|||
void CocosDenshionTest::addChildAt(Node *node, float percentageX, float percentageY)
|
||||
{
|
||||
const Size size = VisibleRect::getVisibleRect().size;
|
||||
node->setPosition(Vec2(percentageX * size.width, percentageY * size.height));
|
||||
node->setPosition(percentageX * size.width, percentageY * size.height);
|
||||
addChild(node);
|
||||
}
|
||||
|
||||
|
|
|
@ -165,8 +165,8 @@ ConsoleCustomCommand::ConsoleCustomCommand()
|
|||
auto label = LabelTTF::create(ss.str(), "Arial", 12);
|
||||
|
||||
// position the label on the center of the screen
|
||||
label->setPosition(Point(origin.x + visibleSize.width/2,
|
||||
origin.y + visibleSize.height/2 + (label->getContentSize().height/2)));
|
||||
label->setPosition(origin.x + visibleSize.width/2,
|
||||
origin.y + visibleSize.height/2 + (label->getContentSize().height/2));
|
||||
|
||||
// add the label as a child to this layer
|
||||
this->addChild(label, 1);
|
||||
|
|
|
@ -7,7 +7,7 @@ CurlTest::CurlTest()
|
|||
{
|
||||
auto label = Label::createWithTTF("Curl Test", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
label->setPosition(VisibleRect::center().x, VisibleRect::top().y-50);
|
||||
|
||||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
listener->onTouchesEnded = CC_CALLBACK_2(CurlTest::onTouchesEnded, this);
|
||||
|
|
|
@ -4,7 +4,7 @@ CurrentLanguageTest::CurrentLanguageTest()
|
|||
{
|
||||
auto label = Label::createWithTTF("Current language Test", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
label->setPosition(VisibleRect::center().x, VisibleRect::top().y-50);
|
||||
|
||||
auto labelLanguage = Label::createWithTTF("", "fonts/arial.ttf", 20);
|
||||
labelLanguage->setPosition(VisibleRect::center());
|
||||
|
|
|
@ -21,11 +21,11 @@ void PrettyPrinterDemo::addSprite()
|
|||
auto s4 = Sprite::create("Images/grossini_dance_03.png");
|
||||
auto s5 = Sprite::create("Images/grossini_dance_04.png");
|
||||
|
||||
s1->setPosition(Vec2(50, 50));
|
||||
s2->setPosition(Vec2(60, 50));
|
||||
s3->setPosition(Vec2(70, 50));
|
||||
s4->setPosition(Vec2(80, 50));
|
||||
s5->setPosition(Vec2(90, 50));
|
||||
s1->setPosition(50, 50);
|
||||
s2->setPosition(60, 50);
|
||||
s3->setPosition(70, 50);
|
||||
s4->setPosition(80, 50);
|
||||
s5->setPosition(90, 50);
|
||||
|
||||
this->addChild(s1);
|
||||
this->addChild(s2);
|
||||
|
@ -40,14 +40,14 @@ void PrettyPrinterDemo::onEnter()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 28);
|
||||
label->setPosition( Vec2(s.width/2, s.height * 4/5) );
|
||||
label->setPosition(s.width/2, s.height * 4/5);
|
||||
this->addChild(label, 1);
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if(strSubtitle.empty() == false)
|
||||
{
|
||||
auto subLabel = Label::createWithTTF(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
subLabel->setPosition( Vec2(s.width/2, s.height * 3/5) );
|
||||
subLabel->setPosition(s.width/2, s.height * 3/5);
|
||||
this->addChild(subLabel, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ void Issue631::onEnter()
|
|||
auto layer = LayerColor::create( Color4B(255,0,0,255) );
|
||||
addChild(layer, -10);
|
||||
auto sprite = Sprite::create("Images/grossini.png");
|
||||
sprite->setPosition( Vec2(50,80) );
|
||||
sprite->setPosition(50,80);
|
||||
layer->addChild(sprite, 10);
|
||||
|
||||
// foreground
|
||||
|
@ -353,7 +353,7 @@ void EffectAdvanceTextLayer::onEnter(void)
|
|||
auto grossini = Sprite::create("Images/grossinis_sister2.png");
|
||||
_target1->addChild(grossini);
|
||||
_bgNode->addChild(_target1);
|
||||
_target1->setPosition( Vec2(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3.0f, VisibleRect::bottom().y+ 200) );
|
||||
_target1->setPosition(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3.0f, VisibleRect::bottom().y+ 200);
|
||||
auto sc = ScaleBy::create(2, 5);
|
||||
auto sc_back = sc->reverse();
|
||||
_target1->runAction( RepeatForever::create(Sequence::create(sc, sc_back, nullptr) ) );
|
||||
|
@ -364,7 +364,7 @@ void EffectAdvanceTextLayer::onEnter(void)
|
|||
auto tamara = Sprite::create("Images/grossinis_sister1.png");
|
||||
_target2->addChild(tamara);
|
||||
_bgNode->addChild(_target2);
|
||||
_target2->setPosition( Vec2(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200) );
|
||||
_target2->setPosition(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200);
|
||||
auto sc2 = ScaleBy::create(2, 5);
|
||||
auto sc2_back = sc2->reverse();
|
||||
_target2->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, nullptr) ) );
|
||||
|
|
|
@ -354,21 +354,21 @@ TextLayer::TextLayer(void)
|
|||
|
||||
auto grossini = Sprite::create(s_pathSister2);
|
||||
_gridNodeTarget->addChild(grossini, 1);
|
||||
grossini->setPosition( Vec2(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
||||
grossini->setPosition(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y);
|
||||
auto sc = ScaleBy::create(2, 5);
|
||||
auto sc_back = sc->reverse();
|
||||
grossini->runAction( RepeatForever::create(Sequence::create(sc, sc_back, nullptr) ) );
|
||||
|
||||
auto tamara = Sprite::create(s_pathSister1);
|
||||
_gridNodeTarget->addChild(tamara, 1);
|
||||
tamara->setPosition( Vec2(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
||||
tamara->setPosition(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y);
|
||||
auto sc2 = ScaleBy::create(2, 5);
|
||||
auto sc2_back = sc2->reverse();
|
||||
tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, nullptr)) );
|
||||
|
||||
auto label = Label::createWithTTF((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32);
|
||||
|
||||
label->setPosition( Vec2(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
label->setPosition(VisibleRect::center().x,VisibleRect::top().y-80);
|
||||
addChild(label);
|
||||
label->setTag( kTagLabel );
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ void ActionTimelineTestLayer::onEnter()
|
|||
auto l = Label::createWithSystemFont(strSubtitle.c_str(), "Arial", 18);
|
||||
l->setColor(Color3B(0, 0, 0));
|
||||
addChild(l, 1, 10001);
|
||||
l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
l->setPosition(VisibleRect::center().x, VisibleRect::top().y - 60);
|
||||
}
|
||||
|
||||
// add menu
|
||||
|
@ -134,9 +134,9 @@ void ActionTimelineTestLayer::onEnter()
|
|||
Menu *menu = Menu::create(backItem, restartItem, nextItem, nullptr);
|
||||
|
||||
menu->setPosition(Point::ZERO);
|
||||
backItem->setPosition(Point(VisibleRect::center().x - restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2));
|
||||
restartItem->setPosition(Point(VisibleRect::center().x, VisibleRect::bottom().y + restartItem->getContentSize().height / 2));
|
||||
nextItem->setPosition(Point(VisibleRect::center().x + restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2));
|
||||
backItem->setPosition(VisibleRect::center().x - restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2);
|
||||
restartItem->setPosition(VisibleRect::center().x, VisibleRect::bottom().y + restartItem->getContentSize().height / 2);
|
||||
nextItem->setPosition(VisibleRect::center().x + restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2);
|
||||
|
||||
addChild(menu, 100);
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ void ArmatureTestLayer::onEnter()
|
|||
auto label = Label::createWithTTF(pTitle, "fonts/arial.ttf", 18);
|
||||
label->setColor(Color3B::BLACK);
|
||||
addChild(label, 1, 10000);
|
||||
label->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
label->setPosition(VisibleRect::center().x, VisibleRect::top().y - 30);
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
|
@ -171,7 +171,7 @@ void ArmatureTestLayer::onEnter()
|
|||
auto l = Label::createWithTTF(strSubtitle.c_str(), "fonts/arial.ttf", 18);
|
||||
l->setColor(Color3B::BLACK);
|
||||
addChild(l, 1, 10001);
|
||||
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
l->setPosition(VisibleRect::center().x, VisibleRect::top().y - 60);
|
||||
}
|
||||
|
||||
// add menu
|
||||
|
@ -182,9 +182,9 @@ void ArmatureTestLayer::onEnter()
|
|||
Menu *menu = Menu::create(backItem, restartItem, nextItem, nullptr);
|
||||
|
||||
menu->setPosition(Vec2::ZERO);
|
||||
backItem->setPosition(Vec2(VisibleRect::center().x - restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2));
|
||||
restartItem->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y + restartItem->getContentSize().height / 2));
|
||||
nextItem->setPosition(Vec2(VisibleRect::center().x + restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2));
|
||||
backItem->setPosition(VisibleRect::center().x - restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2);
|
||||
restartItem->setPosition(VisibleRect::center().x, VisibleRect::bottom().y + restartItem->getContentSize().height / 2);
|
||||
nextItem->setPosition(VisibleRect::center().x + restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2);
|
||||
|
||||
addChild(menu, 100);
|
||||
|
||||
|
@ -306,7 +306,7 @@ void TestDirectLoading::onEnter()
|
|||
|
||||
Armature *armature = Armature::create("bear");
|
||||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y);
|
||||
addChild(armature);
|
||||
}
|
||||
std::string TestDirectLoading::title() const
|
||||
|
@ -323,7 +323,7 @@ void TestCSWithSkeleton::onEnter()
|
|||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setScale(0.2f);
|
||||
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y/*-100*/));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y/*-100*/);
|
||||
addChild(armature);
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ void TestPerformance::onEnter()
|
|||
|
||||
Menu *menu = Menu::create(decrease, increase, nullptr);
|
||||
menu->alignItemsHorizontally();
|
||||
menu->setPosition(Vec2(VisibleRect::getVisibleRect().size.width/2, VisibleRect::getVisibleRect().size.height-100));
|
||||
menu->setPosition(VisibleRect::getVisibleRect().size.width/2, VisibleRect::getVisibleRect().size.height-100);
|
||||
addChild(menu, 10000);
|
||||
|
||||
armatureCount = frames = times = lastTimes = 0;
|
||||
|
@ -471,7 +471,7 @@ void TestChangeZorder::onEnter()
|
|||
|
||||
armature = Armature::create("Knight_f/Knight");
|
||||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y - 100));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y - 100);
|
||||
++currentTag;
|
||||
armature->setScale(0.6f);
|
||||
addChild(armature, currentTag, currentTag);
|
||||
|
@ -479,13 +479,13 @@ void TestChangeZorder::onEnter()
|
|||
armature = Armature::create("Cowboy");
|
||||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setScale(0.24f);
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y - 100));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y - 100);
|
||||
++currentTag;
|
||||
addChild(armature, currentTag, currentTag);
|
||||
|
||||
armature = Armature::create("Dragon");
|
||||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setPosition(Vec2(VisibleRect::center().x , VisibleRect::center().y - 100));
|
||||
armature->setPosition(VisibleRect::center().x , VisibleRect::center().y - 100);
|
||||
++currentTag;
|
||||
armature->setScale(0.6f);
|
||||
addChild(armature, currentTag, currentTag);
|
||||
|
@ -519,7 +519,7 @@ void TestAnimationEvent::onEnter()
|
|||
armature->getAnimation()->play("Fire");
|
||||
armature->setScaleX(-0.24f);
|
||||
armature->setScaleY(0.24f);
|
||||
armature->setPosition(Vec2(VisibleRect::left().x + 50, VisibleRect::left().y));
|
||||
armature->setPosition(VisibleRect::left().x + 50, VisibleRect::left().y);
|
||||
|
||||
/*
|
||||
* Set armature's movement event callback function
|
||||
|
@ -574,7 +574,7 @@ void TestFrameEvent::onEnter()
|
|||
Armature *armature = Armature::create("HeroAnimation");
|
||||
armature->getAnimation()->play("attack");
|
||||
armature->getAnimation()->setSpeedScale(0.5);
|
||||
armature->setPosition(Vec2(VisibleRect::center().x - 50, VisibleRect::center().y -100));
|
||||
armature->setPosition(VisibleRect::center().x - 50, VisibleRect::center().y -100);
|
||||
|
||||
/*
|
||||
* Set armature's frame event callback function
|
||||
|
@ -684,7 +684,7 @@ void TestUseMutiplePicture::onEnter()
|
|||
|
||||
armature = Armature::create("Knight_f/Knight");
|
||||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::left().y));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::left().y);
|
||||
armature->setScale(1.2f);
|
||||
addChild(armature);
|
||||
|
||||
|
@ -744,7 +744,7 @@ void TestColliderDetector::onEnter()
|
|||
armature->getAnimation()->setSpeedScale(0.2f);
|
||||
armature->setScaleX(-0.2f);
|
||||
armature->setScaleY(0.2f);
|
||||
armature->setPosition(Vec2(VisibleRect::left().x + 70, VisibleRect::left().y));
|
||||
armature->setPosition(VisibleRect::left().x + 70, VisibleRect::left().y);
|
||||
|
||||
/*
|
||||
* Set armature's frame event callback function
|
||||
|
@ -757,7 +757,7 @@ void TestColliderDetector::onEnter()
|
|||
armature2->getAnimation()->play("Walk");
|
||||
armature2->setScaleX(-0.2f);
|
||||
armature2->setScaleY(0.2f);
|
||||
armature2->setPosition(Vec2(VisibleRect::right().x - 60, VisibleRect::left().y));
|
||||
armature2->setPosition(VisibleRect::right().x - 60, VisibleRect::left().y);
|
||||
addChild(armature2);
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
|
@ -784,7 +784,7 @@ void TestColliderDetector::onFrameEvent(cocostudio::Bone *bone, const std::strin
|
|||
*/
|
||||
|
||||
Vec2 p = armature->getBone("Layer126")->getDisplayRenderNode()->convertToWorldSpaceAR(Vec2(0, 0));
|
||||
bullet->setPosition(Vec2(p.x + 60, p.y));
|
||||
bullet->setPosition(p.x + 60, p.y);
|
||||
|
||||
bullet->stopAllActions();
|
||||
bullet->runAction(CCMoveBy::create(1.5f, Vec2(350, 0)));
|
||||
|
@ -912,7 +912,7 @@ void TestColliderDetector::initWorld()
|
|||
|
||||
bullet->setB2Body(body);
|
||||
bullet->setPTMRatio(PT_RATIO);
|
||||
bullet->setPosition( Vec2( -100, -100) );
|
||||
bullet->setPosition(-100, -100);
|
||||
|
||||
body = world->CreateBody(&bodyDef);
|
||||
armature2->setBody(body);
|
||||
|
@ -1250,7 +1250,7 @@ void Hero::changeMount(Armature *armature)
|
|||
bone->changeDisplayWithIndex(0, true);
|
||||
bone->setIgnoreMovementBoneData(true);
|
||||
|
||||
setPosition(Vec2(0,0));
|
||||
setPosition(0,0);
|
||||
//Change animation
|
||||
playWithIndex(1);
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ void TestArmatureNesting2::onEnter()
|
|||
Menu* pMenu =Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2() );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 67, VisibleRect::bottom().y + 50) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 67, VisibleRect::bottom().y + 50);
|
||||
|
||||
addChild(pMenu, 2);
|
||||
|
||||
|
@ -1294,7 +1294,7 @@ void TestArmatureNesting2::onEnter()
|
|||
hero = Hero::create("hero");
|
||||
hero->setLayer(this);
|
||||
hero->playWithIndex(0);
|
||||
hero->setPosition(Vec2(VisibleRect::left().x + 20, VisibleRect::left().y));
|
||||
hero->setPosition(VisibleRect::left().x + 20, VisibleRect::left().y);
|
||||
addChild(hero);
|
||||
|
||||
//Create 3 mount
|
||||
|
@ -1393,7 +1393,7 @@ void TestPlaySeveralMovement::onEnter()
|
|||
// armature->getAnimation()->playWithIndexes(indexes);
|
||||
armature->setScale(0.2f);
|
||||
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y/*-100*/));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y/*-100*/);
|
||||
addChild(armature);
|
||||
}
|
||||
std::string TestPlaySeveralMovement::title() const
|
||||
|
@ -1421,7 +1421,7 @@ void TestEasing::onEnter()
|
|||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setScale(0.8f);
|
||||
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y);
|
||||
addChild(armature);
|
||||
|
||||
updateSubTitle();
|
||||
|
@ -1463,7 +1463,7 @@ void TestChangeAnimationInternal::onEnter()
|
|||
armature->getAnimation()->playWithIndex(0);
|
||||
armature->setScale(0.2f);
|
||||
|
||||
armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y));
|
||||
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y);
|
||||
addChild(armature);
|
||||
}
|
||||
void TestChangeAnimationInternal::onExit()
|
||||
|
@ -1523,7 +1523,7 @@ void TestLoadFromBinary::onEnter()
|
|||
m_armature->getAnimation()->playWithIndex(0);
|
||||
m_armature->setScale(1.0f);
|
||||
|
||||
m_armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y));
|
||||
m_armature->setPosition(VisibleRect::center().x, VisibleRect::center().y);
|
||||
addChild(m_armature);
|
||||
|
||||
}
|
||||
|
@ -1567,7 +1567,7 @@ void TestLoadFromBinary::onTouchesEnded(const std::vector<Touch*>& touches, Even
|
|||
m_armature->removeFromParent();
|
||||
m_armatureIndex = m_armatureIndex==BINARYFILECOUNT-1 ? 0 : m_armatureIndex+1;
|
||||
m_armature = Armature::create(m_armatureNames[m_armatureIndex]);
|
||||
m_armature->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y));
|
||||
m_armature->setPosition(VisibleRect::center().x, VisibleRect::center().y);
|
||||
if(m_armatureIndex == 2 ) // cowboy is 0.2
|
||||
m_armature->setScale(0.2f);
|
||||
m_armature->getAnimation()->playWithIndex(0);
|
||||
|
|
|
@ -73,8 +73,8 @@ cocos2d::Node* ComponentsTestLayer::createGameScene()
|
|||
|
||||
auto player = Sprite::create("components/Player.png", Rect(0, 0, 27, 40) );
|
||||
|
||||
player->setPosition( Vec2(origin.x + player->getContentSize().width/2,
|
||||
origin.y + visibleSize.height/2) );
|
||||
player->setPosition(origin.x + player->getContentSize().width/2,
|
||||
origin.y + visibleSize.height/2);
|
||||
|
||||
root = cocos2d::Node::create();
|
||||
root->addChild(player, 1, 1);
|
||||
|
@ -87,7 +87,7 @@ cocos2d::Node* ComponentsTestLayer::createGameScene()
|
|||
});
|
||||
|
||||
itemBack->setColor(Color3B(0, 0, 0));
|
||||
itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
itemBack->setPosition(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25);
|
||||
auto menuBack = Menu::create(itemBack, nullptr);
|
||||
menuBack->setPosition(Vec2::ZERO);
|
||||
addChild(menuBack);
|
||||
|
|
|
@ -63,7 +63,7 @@ bool GameOverLayer::init()
|
|||
this->_label = Label::createWithTTF("","fonts/arial.ttf", 32);
|
||||
_label->retain();
|
||||
_label->setColor( Color3B(0, 0, 0) );
|
||||
_label->setPosition( Vec2(winSize.width/2, winSize.height/2) );
|
||||
_label->setPosition(winSize.width/2, winSize.height/2);
|
||||
this->addChild(_label);
|
||||
|
||||
this->runAction( Sequence::create(
|
||||
|
@ -79,7 +79,7 @@ bool GameOverLayer::init()
|
|||
});
|
||||
|
||||
itemBack->setColor(Color3B(0, 0, 0));
|
||||
itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
itemBack->setPosition(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25);
|
||||
auto menuBack = Menu::create(itemBack, nullptr);
|
||||
menuBack->setPosition(Vec2::ZERO);
|
||||
addChild(menuBack);
|
||||
|
|
|
@ -65,7 +65,7 @@ bool ControlButtonTest_HelloVariableSize::init()
|
|||
button->setColor(Color3B(0, 0, 255));
|
||||
}
|
||||
|
||||
button->setPosition(Vec2 (total_width + button->getContentSize().width / 2, button->getContentSize().height / 2));
|
||||
button->setPosition(total_width + button->getContentSize().width / 2, button->getContentSize().height / 2);
|
||||
layer->addChild(button);
|
||||
|
||||
// Compute the size of the layer
|
||||
|
@ -76,12 +76,12 @@ bool ControlButtonTest_HelloVariableSize::init()
|
|||
|
||||
layer->setAnchorPoint(Vec2 (0.5, 0.5));
|
||||
layer->setContentSize(Size(total_width, height));
|
||||
layer->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
layer->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
|
||||
// Add the black background
|
||||
auto background = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(Size(total_width + 14, height + 14));
|
||||
background->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
background->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
addChild(background);
|
||||
return true;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ bool ControlButtonTest_Event::init()
|
|||
// Add a label in which the button events will be displayed
|
||||
setDisplayValueLabel(Label::createWithTTF("No Event", "fonts/Marker Felt.ttf", 32));
|
||||
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1));
|
||||
_displayValueLabel->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
_displayValueLabel->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
addChild(_displayValueLabel, 1);
|
||||
|
||||
setDisplayBitmaskLabel(Label::createWithTTF("No bitmask event", "fonts/Marker Felt.ttf", 24));
|
||||
|
@ -149,13 +149,13 @@ bool ControlButtonTest_Event::init()
|
|||
controlButton->setTitleColorForState(Color3B::WHITE, Control::State::HIGH_LIGHTED);
|
||||
|
||||
controlButton->setAnchorPoint(Vec2(0.5f, 1));
|
||||
controlButton->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
controlButton->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
addChild(controlButton, 1);
|
||||
|
||||
// Add the black background
|
||||
auto background = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(Size(300, 170));
|
||||
background->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
background->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
addChild(background);
|
||||
|
||||
// Sets up event handlers
|
||||
|
@ -244,8 +244,8 @@ bool ControlButtonTest_Styling::init()
|
|||
ControlButton *button = standardButtonWithTitle(String::createWithFormat("%d",rand() % 30)->getCString());
|
||||
button->setAdjustBackgroundImage(false); // Tells the button that the background image must not be adjust
|
||||
// It'll use the prefered size of the background image
|
||||
button->setPosition(Vec2(button->getContentSize().width / 2 + (button->getContentSize().width + space) * i,
|
||||
button->getContentSize().height / 2 + (button->getContentSize().height + space) * j));
|
||||
button->setPosition(button->getContentSize().width / 2 + (button->getContentSize().width + space) * i,
|
||||
button->getContentSize().height / 2 + (button->getContentSize().height + space) * j);
|
||||
layer->addChild(button);
|
||||
|
||||
max_w = MAX(button->getContentSize().width * (i + 1) + space * i, max_w);
|
||||
|
@ -255,12 +255,12 @@ bool ControlButtonTest_Styling::init()
|
|||
|
||||
layer->setAnchorPoint(Vec2(0.5, 0.5));
|
||||
layer->setContentSize(Size(max_w, max_h));
|
||||
layer->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
layer->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
|
||||
// Add the black background
|
||||
auto backgroundButton = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
backgroundButton->setContentSize(Size(max_w + 14, max_h + 14));
|
||||
backgroundButton->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
backgroundButton->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
addChild(backgroundButton);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ bool ControlColourPickerTest::init()
|
|||
auto screenSize = Director::getInstance()->getWinSize();
|
||||
|
||||
auto layer = Node::create();
|
||||
layer->setPosition(Vec2 (screenSize.width / 2, screenSize.height / 2));
|
||||
layer->setPosition(screenSize.width / 2, screenSize.height / );
|
||||
addChild(layer, 1);
|
||||
|
||||
double layer_width = 0;
|
||||
|
@ -47,7 +47,7 @@ bool ControlColourPickerTest::init()
|
|||
// Create the colour picker
|
||||
ControlColourPicker *colourPicker = ControlColourPicker::create();
|
||||
colourPicker->setColor(Color3B(37, 46, 252));
|
||||
colourPicker->setPosition(Vec2 (colourPicker->getContentSize().width / 2, 0));
|
||||
colourPicker->setPosition(colourPicker->getContentSize().width / 2, 0);
|
||||
|
||||
// Add it to the layer
|
||||
layer->addChild(colourPicker);
|
||||
|
@ -61,7 +61,7 @@ bool ControlColourPickerTest::init()
|
|||
// Add the black background for the text
|
||||
auto background = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(Size(150, 50));
|
||||
background->setPosition(Vec2(layer_width + background->getContentSize().width / 2.0f, 0));
|
||||
background->setPosition(layer_width + background->getContentSize().width / 2.0f, 0);
|
||||
layer->addChild(background);
|
||||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
|
|
@ -42,7 +42,7 @@ bool ControlPotentiometerTest::init()
|
|||
auto screenSize = Director::getInstance()->getWinSize();
|
||||
|
||||
auto layer = Node::create();
|
||||
layer->setPosition(Vec2(screenSize.width / 2, screenSize.height / 2));
|
||||
layer->setPosition(screenSize.width / 2, screenSize.height / 2);
|
||||
this->addChild(layer, 1);
|
||||
|
||||
double layer_width = 0;
|
||||
|
@ -50,7 +50,7 @@ bool ControlPotentiometerTest::init()
|
|||
// Add the black background for the text
|
||||
auto background = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(Size(80, 50));
|
||||
background->setPosition(Vec2(layer_width + background->getContentSize().width / 2.0f, 0));
|
||||
background->setPosition(layer_width + background->getContentSize().width / 2.0f, 0);
|
||||
layer->addChild(background);
|
||||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
@ -64,7 +64,7 @@ bool ControlPotentiometerTest::init()
|
|||
ControlPotentiometer *potentiometer = ControlPotentiometer::create("extensions/potentiometerTrack.png"
|
||||
,"extensions/potentiometerProgress.png"
|
||||
,"extensions/potentiometerButton.png");
|
||||
potentiometer->setPosition(Vec2(layer_width + 10 + potentiometer->getContentSize().width / 2, 0));
|
||||
potentiometer->setPosition(layer_width + 10 + potentiometer->getContentSize().width / 2, 0);
|
||||
|
||||
// When the value of the slider will change, the given selector will be call
|
||||
potentiometer->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlPotentiometerTest::valueChanged), Control::EventType::VALUE_CHANGED);
|
||||
|
|
|
@ -43,7 +43,7 @@ bool ControlScene::init()
|
|||
if (Layer::init())
|
||||
{
|
||||
auto pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(ControlScene::toExtensionsMainLayer, this));
|
||||
pBackItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
pBackItem->setPosition(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25);
|
||||
auto pBackMenu = Menu::create(pBackItem, nullptr);
|
||||
pBackMenu->setPosition( Vec2::ZERO );
|
||||
addChild(pBackMenu, 10);
|
||||
|
@ -56,12 +56,12 @@ bool ControlScene::init()
|
|||
// Add the ribbon
|
||||
auto ribbon = Scale9Sprite::create("extensions/ribbon.png", Rect(1, 1, 48, 55));
|
||||
ribbon->setContentSize(Size(VisibleRect::getVisibleRect().size.width, 57));
|
||||
ribbon->setPosition(Vec2(VisibleRect::center().x, VisibleRect::top().y - ribbon->getContentSize().height / 2.0f));
|
||||
ribbon->setPosition(VisibleRect::center().x, VisibleRect::top().y - ribbon->getContentSize().height / 2.0f);
|
||||
addChild(ribbon);
|
||||
|
||||
// Add the title
|
||||
setSceneTitleLabel(Label::createWithTTF("Title", "fonts/arial.ttf", 12));
|
||||
_sceneTitleLabel->setPosition(Vec2 (VisibleRect::center().x, VisibleRect::top().y - _sceneTitleLabel->getContentSize().height / 2 - 5));
|
||||
_sceneTitleLabel->setPosition(VisibleRect::center().x, VisibleRect::top().y - _sceneTitleLabel->getContentSize().height / 2 - 5);
|
||||
addChild(_sceneTitleLabel, 1);
|
||||
|
||||
// Add the menu
|
||||
|
@ -71,9 +71,9 @@ bool ControlScene::init()
|
|||
|
||||
auto menu = Menu::create(item1, item3, item2, nullptr);
|
||||
menu->setPosition(Vec2::ZERO);
|
||||
item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(Vec2(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item1->setPosition(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
item2->setPosition(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
item3->setPosition(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2);
|
||||
|
||||
addChild(menu ,1);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ bool ControlSliderTest::init()
|
|||
_displayValueLabel = Label::createWithTTF("Move the slider thumb!\nThe lower slider is restricted." ,"fonts/Marker Felt.ttf", 32);
|
||||
_displayValueLabel->retain();
|
||||
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
||||
_displayValueLabel->setPosition(Vec2(screenSize.width / 1.7f, screenSize.height / 2.0f));
|
||||
_displayValueLabel->setPosition(screenSize.width / 1.7f, screenSize.height / 2.0f);
|
||||
addChild(_displayValueLabel);
|
||||
|
||||
// Add the slider
|
||||
|
@ -54,7 +54,7 @@ bool ControlSliderTest::init()
|
|||
slider->setAnchorPoint(Vec2(0.5f, 1.0f));
|
||||
slider->setMinimumValue(0.0f); // Sets the min value of range
|
||||
slider->setMaximumValue(5.0f); // Sets the max value of range
|
||||
slider->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f + 16));
|
||||
slider->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f + 16);
|
||||
slider->setTag(1);
|
||||
|
||||
// When the value of the slider will change, the given selector will be call
|
||||
|
@ -67,7 +67,7 @@ bool ControlSliderTest::init()
|
|||
restrictSlider->setMaximumAllowedValue(4.0f);
|
||||
restrictSlider->setMinimumAllowedValue(1.5f);
|
||||
restrictSlider->setValue(3.0f);
|
||||
restrictSlider->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f - 24));
|
||||
restrictSlider->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f - 24);
|
||||
restrictSlider->setTag(2);
|
||||
|
||||
//same with restricted
|
||||
|
|
|
@ -43,7 +43,7 @@ bool ControlStepperTest::init()
|
|||
auto screenSize = Director::getInstance()->getWinSize();
|
||||
|
||||
auto layer = Node::create();
|
||||
layer->setPosition(Vec2 (screenSize.width / 2, screenSize.height / 2));
|
||||
layer->setPosition(screenSize.width / 2, screenSize.height / 2);
|
||||
this->addChild(layer, 1);
|
||||
|
||||
double layer_width = 0;
|
||||
|
@ -51,7 +51,7 @@ bool ControlStepperTest::init()
|
|||
// Add the black background for the text
|
||||
auto background = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(Size(100, 50));
|
||||
background->setPosition(Vec2(layer_width + background->getContentSize().width / 2.0f, 0));
|
||||
background->setPosition(layer_width + background->getContentSize().width / 2.0f, 0);
|
||||
layer->addChild(background);
|
||||
|
||||
this->setDisplayValueLabel(Label::createWithSystemFont("0", "HelveticaNeue-Bold", 30));
|
||||
|
@ -62,7 +62,7 @@ bool ControlStepperTest::init()
|
|||
layer_width += background->getContentSize().width;
|
||||
|
||||
ControlStepper *stepper = this->makeControlStepper();
|
||||
stepper->setPosition(Vec2(layer_width + 10 + stepper->getContentSize().width / 2, 0));
|
||||
stepper->setPosition(layer_width + 10 + stepper->getContentSize().width / 2, 0);
|
||||
stepper->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlStepperTest::valueChanged), Control::EventType::VALUE_CHANGED);
|
||||
layer->addChild(stepper);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ bool ControlSwitchTest::init()
|
|||
auto screenSize = Director::getInstance()->getWinSize();
|
||||
|
||||
auto layer = Node::create();
|
||||
layer->setPosition(Vec2(screenSize.width / 2, screenSize.height / 2));
|
||||
layer->setPosition(screenSize.width / 2, screenSize.height / 2);
|
||||
addChild(layer, 1);
|
||||
|
||||
double layer_width = 0;
|
||||
|
@ -46,7 +46,7 @@ bool ControlSwitchTest::init()
|
|||
// Add the black background for the text
|
||||
auto background = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
background->setContentSize(Size(80, 50));
|
||||
background->setPosition(Vec2(layer_width + background->getContentSize().width / 2.0f, 0));
|
||||
background->setPosition(layer_width + background->getContentSize().width / 2.0f, 0);
|
||||
layer->addChild(background);
|
||||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
@ -67,7 +67,7 @@ bool ControlSwitchTest::init()
|
|||
Label::createWithSystemFont("On", "Arial-BoldMT", 16),
|
||||
Label::createWithSystemFont("Off", "Arial-BoldMT", 16)
|
||||
);
|
||||
switchControl->setPosition(Vec2(layer_width + 10 + switchControl->getContentSize().width / 2, 0));
|
||||
switchControl->setPosition(layer_width + 10 + switchControl->getContentSize().width / 2, 0);
|
||||
layer->addChild(switchControl);
|
||||
|
||||
switchControl->addTargetWithActionForControlEvents(this, cccontrol_selector(ControlSwitchTest::valueChanged), Control::EventType::VALUE_CHANGED);
|
||||
|
|
|
@ -20,16 +20,16 @@ EditBoxTest::EditBoxTest()
|
|||
auto visibleSize = glview->getVisibleSize();
|
||||
|
||||
auto pBg = Sprite::create("Images/HelloWorld.png");
|
||||
pBg->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
pBg->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2);
|
||||
addChild(pBg);
|
||||
|
||||
_TTFShowEditReturn = Label::createWithSystemFont("No edit control return!", "", 30);
|
||||
_TTFShowEditReturn->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50));
|
||||
_TTFShowEditReturn->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50);
|
||||
addChild(_TTFShowEditReturn);
|
||||
|
||||
// Back Menu
|
||||
auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(EditBoxTest::toExtensionsMainLayer, this));
|
||||
itemBack->setPosition(Vec2(visibleOrigin.x+visibleSize.width - 50, visibleOrigin.y+25));
|
||||
itemBack->setPosition(visibleOrigin.x+visibleSize.width - 50, visibleOrigin.y+25);
|
||||
auto menuBack = Menu::create(itemBack, nullptr);
|
||||
menuBack->setPosition(Vec2::ZERO);
|
||||
addChild(menuBack);
|
||||
|
@ -38,7 +38,7 @@ EditBoxTest::EditBoxTest()
|
|||
|
||||
// top
|
||||
_editName = EditBox::create(editBoxSize, Scale9Sprite::create("extensions/green_edit.png"));
|
||||
_editName->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4));
|
||||
_editName->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4);
|
||||
_editName->setFontName("Paint Boy");
|
||||
_editName->setFontSize(25);
|
||||
_editName->setFontColor(Color3B::RED);
|
||||
|
@ -51,7 +51,7 @@ EditBoxTest::EditBoxTest()
|
|||
|
||||
// middle
|
||||
_editPassword = EditBox::create(editBoxSize, Scale9Sprite::create("extensions/orange_edit.png"));
|
||||
_editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
_editPassword->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2);
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
_editPassword->setFont("American Typewriter", 30);
|
||||
#else
|
||||
|
@ -68,14 +68,14 @@ EditBoxTest::EditBoxTest()
|
|||
|
||||
// bottom
|
||||
_editEmail = EditBox::create(Size(editBoxSize.width, editBoxSize.height), Scale9Sprite::create("extensions/yellow_edit.png"));
|
||||
_editEmail->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4));
|
||||
_editEmail->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4);
|
||||
_editEmail->setAnchorPoint(Vec2(0.5, 1.0f));
|
||||
_editEmail->setPlaceHolder("Email:");
|
||||
_editEmail->setInputMode(EditBox::InputMode::EMAIL_ADDRESS);
|
||||
_editEmail->setDelegate(this);
|
||||
addChild(_editEmail);
|
||||
|
||||
this->setPosition(Vec2(10, 20));
|
||||
this->setPosition(10, 20);
|
||||
}
|
||||
|
||||
EditBoxTest::~EditBoxTest()
|
||||
|
|
|
@ -159,7 +159,7 @@ void ExtensionsMainLayer::onTouchesMoved(const std::vector<Touch*>& touches, Eve
|
|||
|
||||
if (nextPos.y > ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
_itemMenu->setPosition(Vec2(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
_itemMenu->setPosition(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ void ExtensionsMainLayer::onMouseScroll(Event* event)
|
|||
|
||||
if (nextPos.y > ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
_itemMenu->setPosition(Vec2(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
_itemMenu->setPosition(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ HttpClientTest::HttpClientTest()
|
|||
const int RIGHT = winSize.width / 4 * 3;
|
||||
|
||||
auto label = Label::createWithTTF("Http Request Test", "fonts/arial.ttf", 28);
|
||||
label->setPosition(Vec2(winSize.width / 2, winSize.height - MARGIN));
|
||||
label->setPosition(winSize.width / 2, winSize.height - MARGIN);
|
||||
addChild(label, 0);
|
||||
|
||||
auto menuRequest = Menu::create();
|
||||
|
@ -28,71 +28,71 @@ HttpClientTest::HttpClientTest()
|
|||
// Get
|
||||
auto labelGet = Label::createWithTTF("Test Get", "fonts/arial.ttf", 22);
|
||||
auto itemGet = MenuItemLabel::create(labelGet, CC_CALLBACK_1(HttpClientTest::onMenuGetTestClicked, this, false));
|
||||
itemGet->setPosition(Vec2(LEFT, winSize.height - MARGIN - SPACE));
|
||||
itemGet->setPosition(LEFT, winSize.height - MARGIN - SPACE);
|
||||
menuRequest->addChild(itemGet);
|
||||
|
||||
// Post
|
||||
auto labelPost = Label::createWithTTF("Test Post", "fonts/arial.ttf", 22);
|
||||
auto itemPost = MenuItemLabel::create(labelPost, CC_CALLBACK_1(HttpClientTest::onMenuPostTestClicked, this, false));
|
||||
itemPost->setPosition(Vec2(LEFT, winSize.height - MARGIN - 2 * SPACE));
|
||||
itemPost->setPosition(LEFT, winSize.height - MARGIN - 2 * SPACE);
|
||||
menuRequest->addChild(itemPost);
|
||||
|
||||
// Post Binary
|
||||
auto labelPostBinary = Label::createWithTTF("Test Post Binary", "fonts/arial.ttf", 22);
|
||||
auto itemPostBinary = MenuItemLabel::create(labelPostBinary, CC_CALLBACK_1(HttpClientTest::onMenuPostBinaryTestClicked, this, false));
|
||||
itemPostBinary->setPosition(Vec2(LEFT, winSize.height - MARGIN - 3 * SPACE));
|
||||
itemPostBinary->setPosition(LEFT, winSize.height - MARGIN - 3 * SPACE);
|
||||
menuRequest->addChild(itemPostBinary);
|
||||
|
||||
// Put
|
||||
auto labelPut = Label::createWithTTF("Test Put", "fonts/arial.ttf", 22);
|
||||
auto itemPut = MenuItemLabel::create(labelPut, CC_CALLBACK_1(HttpClientTest::onMenuPutTestClicked, this, false));
|
||||
itemPut->setPosition(Vec2(LEFT, winSize.height - MARGIN - 4 * SPACE));
|
||||
itemPut->setPosition(LEFT, winSize.height - MARGIN - 4 * SPACE);
|
||||
menuRequest->addChild(itemPut);
|
||||
|
||||
// Delete
|
||||
auto labelDelete = Label::createWithTTF("Test Delete", "fonts/arial.ttf", 22);
|
||||
auto itemDelete = MenuItemLabel::create(labelDelete, CC_CALLBACK_1(HttpClientTest::onMenuDeleteTestClicked, this, false));
|
||||
itemDelete->setPosition(Vec2(LEFT, winSize.height - MARGIN - 5 * SPACE));
|
||||
itemDelete->setPosition(LEFT, winSize.height - MARGIN - 5 * SPACE);
|
||||
menuRequest->addChild(itemDelete);
|
||||
|
||||
// Get for sendImmediate
|
||||
labelGet = Label::createWithTTF("Test Immediate Get", "fonts/arial.ttf", 22);
|
||||
itemGet = MenuItemLabel::create(labelGet, CC_CALLBACK_1(HttpClientTest::onMenuGetTestClicked, this, true));
|
||||
itemGet->setPosition(Vec2(RIGHT, winSize.height - MARGIN - SPACE));
|
||||
itemGet->setPosition(RIGHT, winSize.height - MARGIN - SPACE);
|
||||
menuRequest->addChild(itemGet);
|
||||
|
||||
// Post for sendImmediate
|
||||
labelPost = Label::createWithTTF("Test Immediate Post", "fonts/arial.ttf", 22);
|
||||
itemPost = MenuItemLabel::create(labelPost, CC_CALLBACK_1(HttpClientTest::onMenuPostTestClicked, this, true));
|
||||
itemPost->setPosition(Vec2(RIGHT, winSize.height - MARGIN - 2 * SPACE));
|
||||
itemPost->setPosition(RIGHT, winSize.height - MARGIN - 2 * SPACE);
|
||||
menuRequest->addChild(itemPost);
|
||||
|
||||
// Post Binary for sendImmediate
|
||||
labelPostBinary = Label::createWithTTF("Test Immediate Post Binary", "fonts/arial.ttf", 22);
|
||||
itemPostBinary = MenuItemLabel::create(labelPostBinary, CC_CALLBACK_1(HttpClientTest::onMenuPostBinaryTestClicked, this, true));
|
||||
itemPostBinary->setPosition(Vec2(RIGHT, winSize.height - MARGIN - 3 * SPACE));
|
||||
itemPostBinary->setPosition(RIGHT, winSize.height - MARGIN - 3 * SPACE);
|
||||
menuRequest->addChild(itemPostBinary);
|
||||
|
||||
// Put for sendImmediate
|
||||
labelPut = Label::createWithTTF("Test Immediate Put", "fonts/arial.ttf", 22);
|
||||
itemPut = MenuItemLabel::create(labelPut, CC_CALLBACK_1(HttpClientTest::onMenuPutTestClicked, this, true));
|
||||
itemPut->setPosition(Vec2(RIGHT, winSize.height - MARGIN - 4 * SPACE));
|
||||
itemPut->setPosition(RIGHT, winSize.height - MARGIN - 4 * SPACE);
|
||||
menuRequest->addChild(itemPut);
|
||||
|
||||
// Delete for sendImmediate
|
||||
labelDelete = Label::createWithTTF("Test Immediate Delete", "fonts/arial.ttf", 22);
|
||||
itemDelete = MenuItemLabel::create(labelDelete, CC_CALLBACK_1(HttpClientTest::onMenuDeleteTestClicked, this, true));
|
||||
itemDelete->setPosition(Vec2(RIGHT, winSize.height - MARGIN - 5 * SPACE));
|
||||
itemDelete->setPosition(RIGHT, winSize.height - MARGIN - 5 * SPACE);
|
||||
menuRequest->addChild(itemDelete);
|
||||
|
||||
// Response Code Label
|
||||
_labelStatusCode = Label::createWithTTF("HTTP Status Code", "fonts/arial.ttf", 18);
|
||||
_labelStatusCode->setPosition(Vec2(winSize.width / 2, winSize.height - MARGIN - 6 * SPACE));
|
||||
_labelStatusCode->setPosition(winSize.width / 2, winSize.height - MARGIN - 6 * SPACE);
|
||||
addChild(_labelStatusCode);
|
||||
|
||||
// Back Menu
|
||||
auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(HttpClientTest::toExtensionsMainLayer, this));
|
||||
itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
itemBack->setPosition(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25);
|
||||
auto menuBack = Menu::create(itemBack, nullptr);
|
||||
menuBack->setPosition(Vec2::ZERO);
|
||||
addChild(menuBack);
|
||||
|
|
|
@ -246,7 +246,7 @@ void TestFilenameLookup::onEnter()
|
|||
this->addChild(sprite);
|
||||
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
sprite->setPosition(Vec2(s.width/2, s.height/2));
|
||||
sprite->setPosition(s.width/2, s.height/2);
|
||||
}
|
||||
|
||||
void TestFilenameLookup::onExit()
|
||||
|
@ -279,12 +279,12 @@ void TestIsFileExist::onEnter()
|
|||
isExist = sharedFileUtils->isFileExist("Images/grossini.png");
|
||||
|
||||
label = Label::createWithSystemFont(isExist ? "Images/grossini.png exists" : "Images/grossini.png doesn't exist", "", 20);
|
||||
label->setPosition(Vec2(s.width/2, s.height/3));
|
||||
label->setPosition(s.width/2, s.height/3);
|
||||
this->addChild(label);
|
||||
|
||||
isExist = sharedFileUtils->isFileExist("Images/grossini.xcf");
|
||||
label = Label::createWithSystemFont(isExist ? "Images/grossini.xcf exists" : "Images/grossini.xcf doesn't exist", "", 20);
|
||||
label->setPosition(Vec2(s.width/2, s.height/3*2));
|
||||
label->setPosition(s.width/2, s.height/3*2);
|
||||
this->addChild(label);
|
||||
}
|
||||
|
||||
|
@ -335,21 +335,21 @@ void TestFileFuncs::onEnter()
|
|||
if (sharedFileUtils->isFileExist(filepath))
|
||||
{
|
||||
label = Label::createWithSystemFont("Test file '__test.test' created", "", 20);
|
||||
label->setPosition(Vec2(x, y * 4));
|
||||
label->setPosition(x, y * 4);
|
||||
this->addChild(label);
|
||||
|
||||
// getFileSize Test
|
||||
long size = sharedFileUtils->getFileSize(filepath);
|
||||
msg = StringUtils::format("getFileSize: Test file size equals %ld", size);
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(Vec2(x, y * 3));
|
||||
label->setPosition(x, y * 3);
|
||||
this->addChild(label);
|
||||
|
||||
// renameFile Test
|
||||
if (sharedFileUtils->renameFile(sharedFileUtils->getWritablePath(), filename, filename2))
|
||||
{
|
||||
label = Label::createWithSystemFont("renameFile: Test file renamed to '__newtest.test'", "", 20);
|
||||
label->setPosition(Vec2(x, y * 2));
|
||||
label->setPosition(x, y * 2);
|
||||
this->addChild(label);
|
||||
|
||||
// removeFile Test
|
||||
|
@ -357,27 +357,27 @@ void TestFileFuncs::onEnter()
|
|||
if (sharedFileUtils->removeFile(filepath))
|
||||
{
|
||||
label = Label::createWithSystemFont("removeFile: Test file removed", "", 20);
|
||||
label->setPosition(Vec2(x, y * 1));
|
||||
label->setPosition(x, y * 1);
|
||||
this->addChild(label);
|
||||
}
|
||||
else
|
||||
{
|
||||
label = Label::createWithSystemFont("removeFile: Failed to remove test file", "", 20);
|
||||
label->setPosition(Vec2(x, y * 1));
|
||||
label->setPosition(x, y * 1);
|
||||
this->addChild(label);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label = Label::createWithSystemFont("renameFile: Failed to rename test file to '__newtest.test', further test skipped", "", 20);
|
||||
label->setPosition(Vec2(x, y * 2));
|
||||
label->setPosition(x, y * 2);
|
||||
this->addChild(label);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label = Label::createWithSystemFont("Test file can not be created, test skipped", "", 20);
|
||||
label->setPosition(Vec2(x, y * 4));
|
||||
label->setPosition(x, y * 4);
|
||||
this->addChild(label);
|
||||
}
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ void TestDirectoryFuncs::onEnter()
|
|||
{
|
||||
msg = StringUtils::format("createDirectory: Directory '__test' created");
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(Vec2(x, y * 3));
|
||||
label->setPosition(x, y * 3);
|
||||
this->addChild(label);
|
||||
|
||||
// Create sub directories recursively
|
||||
|
@ -424,14 +424,14 @@ void TestDirectoryFuncs::onEnter()
|
|||
{
|
||||
msg = StringUtils::format("createDirectory: Sub directories '%s' created", subDir.c_str());
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(Vec2(x, y * 2));
|
||||
label->setPosition(x, y * 2);
|
||||
this->addChild(label);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = StringUtils::format("createDirectory: Failed to create sub directories '%s'", subDir.c_str());
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(Vec2(x, y * 2));
|
||||
label->setPosition(x, y * 2);
|
||||
this->addChild(label);
|
||||
}
|
||||
|
||||
|
@ -441,14 +441,14 @@ void TestDirectoryFuncs::onEnter()
|
|||
{
|
||||
msg = StringUtils::format("removeDirectory: Directory '__test' removed");
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(Vec2(x, y));
|
||||
label->setPosition(x, y);
|
||||
this->addChild(label);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = StringUtils::format("removeDirectory: Failed to remove directory '__test'");
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(Vec2(x, y));
|
||||
label->setPosition(x, y);
|
||||
this->addChild(label);
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ void TestDirectoryFuncs::onEnter()
|
|||
{
|
||||
msg = StringUtils::format("createDirectory: Directory '__test' can not be created");
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(Vec2(x, y * 2));
|
||||
label->setPosition(x, y * 2);
|
||||
this->addChild(label);
|
||||
}
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ void TextWritePlist::onEnter()
|
|||
auto label = Label::createWithTTF(fullPath.c_str(), "fonts/Thonburi.ttf", 6);
|
||||
this->addChild(label);
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
label->setPosition(Vec2(winSize.width/2, winSize.height/3));
|
||||
label->setPosition(winSize.width/2, winSize.height/3);
|
||||
|
||||
auto loadDict = __Dictionary::createWithContentsOfFile(fullPath.c_str());
|
||||
auto loadDictInDict = (__Dictionary*)loadDict->objectForKey("dictInDict, Hello World");
|
||||
|
|
|
@ -111,12 +111,12 @@ void FontTest::showFont(const char *pFont)
|
|||
right->setAnchorPoint(Vec2(0,0.5));
|
||||
rightColor->setAnchorPoint(Vec2(0,0.5));
|
||||
|
||||
top->setPosition(Vec2(s.width/2,s.height-20));
|
||||
left->setPosition(Vec2(0,s.height/2));
|
||||
top->setPosition(s.width/2,s.height-20);
|
||||
left->setPosition(0,s.height/2);
|
||||
leftColor->setPosition(left->getPosition());
|
||||
center->setPosition(Vec2(blockSize.width, s.height/2));
|
||||
center->setPosition(blockSize.width, s.height/2);
|
||||
centerColor->setPosition(center->getPosition());
|
||||
right->setPosition(Vec2(blockSize.width*2, s.height/2));
|
||||
right->setPosition(blockSize.width*2, s.height/2);
|
||||
rightColor->setPosition(right->getPosition());
|
||||
|
||||
this->addChild(leftColor, -1, kTagColor1);
|
||||
|
|
|
@ -17,7 +17,7 @@ IntervalLayer::IntervalLayer()
|
|||
// sun
|
||||
auto sun = ParticleSun::create();
|
||||
sun->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png"));
|
||||
sun->setPosition( Vec2(VisibleRect::rightTop().x-32,VisibleRect::rightTop().y-32) );
|
||||
sun->setPosition(VisibleRect::rightTop().x-32,VisibleRect::rightTop().y-32);
|
||||
|
||||
sun->setTotalParticles(130);
|
||||
sun->setLife(0.6f);
|
||||
|
@ -36,11 +36,11 @@ IntervalLayer::IntervalLayer()
|
|||
schedule(schedule_selector(IntervalLayer::step3), 1.0f);
|
||||
schedule(schedule_selector(IntervalLayer::step4), 2.0f);
|
||||
|
||||
_label0->setPosition(Vec2(s.width*1/6, s.height/2));
|
||||
_label1->setPosition(Vec2(s.width*2/6, s.height/2));
|
||||
_label2->setPosition(Vec2(s.width*3/6, s.height/2));
|
||||
_label3->setPosition(Vec2(s.width*4/6, s.height/2));
|
||||
_label4->setPosition(Vec2(s.width*5/6, s.height/2));
|
||||
_label0->setPosition(s.width*1/6, s.height/2);
|
||||
_label1->setPosition(s.width*2/6, s.height/2);
|
||||
_label2->setPosition(s.width*3/6, s.height/2);
|
||||
_label3->setPosition(s.width*4/6, s.height/2);
|
||||
_label4->setPosition(s.width*5/6, s.height/2);
|
||||
|
||||
addChild(_label0);
|
||||
addChild(_label1);
|
||||
|
@ -50,7 +50,7 @@ IntervalLayer::IntervalLayer()
|
|||
|
||||
// Sprite
|
||||
auto sprite = Sprite::create(s_pathGrossini);
|
||||
sprite->setPosition( Vec2(VisibleRect::left().x + 40, VisibleRect::bottom().y + 50) );
|
||||
sprite->setPosition(VisibleRect::left().x + 40, VisibleRect::bottom().y + 50);
|
||||
|
||||
auto jump = JumpBy::create(3, Vec2(s.width-80,0), 50, 4);
|
||||
|
||||
|
@ -64,7 +64,7 @@ IntervalLayer::IntervalLayer()
|
|||
Director::getInstance()->pause();
|
||||
});
|
||||
auto menu = Menu::create(item1, nullptr);
|
||||
menu->setPosition( Vec2(s.width/2, s.height-50) );
|
||||
menu->setPosition(s.width/2, s.height-50);
|
||||
|
||||
addChild( menu );
|
||||
}
|
||||
|
|
|
@ -30,12 +30,12 @@ void Ball::move(float delta)
|
|||
|
||||
if (getPosition().x > VisibleRect::right().x - radius())
|
||||
{
|
||||
setPosition( Vec2( VisibleRect::right().x - radius(), getPosition().y) );
|
||||
setPosition(VisibleRect::right().x - radius(), getPosition().y);
|
||||
_velocity.x *= -1;
|
||||
}
|
||||
else if (getPosition().x < VisibleRect::left().x + radius())
|
||||
{
|
||||
setPosition( Vec2(VisibleRect::left().x + radius(), getPosition().y) );
|
||||
setPosition(VisibleRect::left().x + radius(), getPosition().y);
|
||||
_velocity.x *= -1;
|
||||
}
|
||||
}
|
||||
|
@ -60,13 +60,13 @@ void Ball::collideWithPaddle(Paddle* paddle)
|
|||
|
||||
if (getPosition().y > midY && getPosition().y <= highY + radius())
|
||||
{
|
||||
setPosition( Vec2(getPosition().x, highY + radius()) );
|
||||
setPosition(getPosition().x, highY + radius());
|
||||
hit = true;
|
||||
angleOffset = (float)M_PI / 2;
|
||||
}
|
||||
else if (getPosition().y < midY && getPosition().y >= lowY - radius())
|
||||
{
|
||||
setPosition( Vec2(getPosition().x, lowY - radius()) );
|
||||
setPosition(getPosition().x, lowY - radius());
|
||||
hit = true;
|
||||
angleOffset = -(float)M_PI / 2;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ void CocoStudioGUIMainLayer::onEnter()
|
|||
for (int i = 0; i < g_maxTests; ++i)
|
||||
{
|
||||
auto pItem = MenuItemFont::create(g_guisTests[i].name, g_guisTests[i].callback);
|
||||
pItem->setPosition(Vec2(s.width / 2, s.height / 4 * 3 - (i + 1) * LINE_SPACE));
|
||||
pItem->setPosition(s.width / 2, s.height / 4 * 3 - (i + 1) * LINE_SPACE);
|
||||
_itemMenu->addChild(pItem, kItemTagBasic + i);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void CocoStudioGUITestScene::onEnter()
|
|||
Menu* pMenu = Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ void CocosGUITestMainLayer::onEnter()
|
|||
for (int i = 0; i < g_maxTests; ++i)
|
||||
{
|
||||
auto pItem = MenuItemFont::create(g_guisTests[i].name, g_guisTests[i].callback);
|
||||
pItem->setPosition(Vec2(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
pItem->setPosition(s.width / 2, s.height - (i + 1) * LINE_SPACE);
|
||||
_itemMenu->addChild(pItem, kItemTagBasic + i);
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ void CocosGUITestMainLayer::onTouchesMoved(const std::vector<Touch*>& touches, E
|
|||
|
||||
if (nextPos.y > ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
_itemMenu->setPosition(Vec2(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
_itemMenu->setPosition(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ void CocosGUITestScene::onEnter()
|
|||
Menu* pMenu =Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ void CocostudioParserTestMainLayer::onEnter()
|
|||
for (int i = 0; i < g_maxTests; ++i)
|
||||
{
|
||||
auto pItem = MenuItemFont::create(g_guisTests[i].name, g_guisTests[i].callback);
|
||||
// pItem->setPosition(Vec2(s.width / 2, s.height / 2));
|
||||
pItem->setPosition(Vec2(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
// pItem->setPosition(s.width / 2, s.height / 2);
|
||||
pItem->setPosition(s.width / 2, s.height - (i + 1) * LINE_SPACE);
|
||||
_itemMenu->addChild(pItem, kItemTagBasic + i);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ void CocostudioParserTestScene::onEnter()
|
|||
Menu* pMenu = Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ void CocostudioParserJsonScene::onEnter()
|
|||
Menu* pMenu = Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ void CustomGUITestMainLayer::onEnter()
|
|||
for (int i = 0; i < g_maxTests; ++i)
|
||||
{
|
||||
auto pItem = MenuItemFont::create(g_guisTests[i].name, g_guisTests[i].callback);
|
||||
// pItem->setPosition(Vec2(s.width / 2, s.height / 2));
|
||||
pItem->setPosition(Vec2(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
// pItem->setPosition(s.width / 2, s.height / 2);
|
||||
pItem->setPosition(s.width / 2, s.height - (i + 1) * LINE_SPACE);
|
||||
_itemMenu->addChild(pItem, kItemTagBasic + i);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ void CustomGUITestScene::onEnter()
|
|||
Menu* pMenu = Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void CustomImageScene::onEnter()
|
|||
Menu* pMenu = Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ void CustomParticleWidgetScene::onEnter()
|
|||
Menu* pMenu = Menu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ void GUIEditorMainLayer::onEnter()
|
|||
for (int i = 0; i < g_maxTests; ++i)
|
||||
{
|
||||
auto pItem = MenuItemFont::create(g_guisTests[i].name, g_guisTests[i].callback);
|
||||
pItem->setPosition(Vec2(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
pItem->setPosition(s.width / 2, s.height - (i + 1) * LINE_SPACE);
|
||||
_itemMenu->addChild(pItem, kItemTagBasic + i);
|
||||
}
|
||||
|
||||
|
@ -313,8 +313,8 @@ void GUIEditorMainLayer::onTouchesMoved(const std::vector<Touch*>& touches, Even
|
|||
}
|
||||
|
||||
if (nextPos.y > ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
_itemMenu->setPosition(Vec2(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
|
||||
_itemMenu->setPosition(0, ((g_maxTests + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ void GUIEditorTestScene::onEnter()
|
|||
Menu* pMenu =CCMenu::create(pMenuItem, nullptr);
|
||||
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
pMenuItem->setPosition(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25);
|
||||
|
||||
addChild(pMenu, 1);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ TestController::TestController()
|
|||
auto menu =Menu::create(closeItem, nullptr);
|
||||
|
||||
menu->setPosition( Vec2::ZERO );
|
||||
closeItem->setPosition(Vec2( VisibleRect::right().x - 30, VisibleRect::top().y - 30));
|
||||
closeItem->setPosition(VisibleRect::right().x - 30, VisibleRect::top().y - 30);
|
||||
|
||||
// add menu items for tests
|
||||
TTFConfig ttfConfig("fonts/arial.ttf", 24);
|
||||
|
@ -137,7 +137,7 @@ TestController::TestController()
|
|||
auto menuItem = MenuItemLabel::create(label, CC_CALLBACK_1(TestController::menuCallback, this));
|
||||
|
||||
_itemMenu->addChild(menuItem, i + 10000);
|
||||
menuItem->setPosition( Vec2( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));
|
||||
menuItem->setPosition(VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE));
|
||||
}
|
||||
|
||||
_itemMenu->setContentSize(Size(VisibleRect::getVisibleRect().size.width, (g_testCount + 1) * (LINE_SPACE)));
|
||||
|
@ -217,7 +217,7 @@ void TestController::onTouchMoved(Touch* touch, Event *event)
|
|||
|
||||
if (nextPos.y > ((g_testCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
_itemMenu->setPosition(Vec2(0, ((g_testCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
_itemMenu->setPosition(0, ((g_testCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ void TestController::onMouseScroll(Event *event)
|
|||
|
||||
if (nextPos.y > ((g_testCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
|
||||
{
|
||||
_itemMenu->setPosition(Vec2(0, ((g_testCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
|
||||
_itemMenu->setPosition(0, ((g_testCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ void GameControllerTest::onConnectController(Controller* controller, Event* even
|
|||
_secondHolder._holderNode->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_secondHolder._holderNode->setScale(0.1f);
|
||||
_secondHolder._holderNode->runAction(ScaleTo::create(0.3f,0.5f,0.5f));
|
||||
_secondHolder._holderNode->setPosition(Vec2(_visibleThreeQuarterX, _visibleCentreY));
|
||||
_secondHolder._holderNode->setPosition(_visibleThreeQuarterX, _visibleCentreY);
|
||||
this->addChild(_secondHolder._holderNode);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void GameControllerTest::onConnectController(Controller* controller, Event* even
|
|||
_firstHolder._holderNode->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_firstHolder._holderNode->setScale(0.1f);
|
||||
_firstHolder._holderNode->runAction(ScaleTo::create(0.3f,0.5f,0.5f));
|
||||
_firstHolder._holderNode->setPosition(Vec2(_visibleThreeQuarterX, _visibleCentreY));
|
||||
_firstHolder._holderNode->setPosition(_visibleThreeQuarterX, _visibleCentreY);
|
||||
this->addChild(_firstHolder._holderNode);
|
||||
}
|
||||
|
||||
|
@ -146,8 +146,8 @@ void GameControllerTest::resetControllerHolderState(ControllerHolder& holder)
|
|||
holder._buttonL1->setColor(Color3B::WHITE);
|
||||
holder._buttonR1->setColor(Color3B::WHITE);
|
||||
|
||||
holder._leftJoystick->setPosition(Vec2(238,460));
|
||||
holder._rightJoystick->setPosition(Vec2(606,293));
|
||||
holder._leftJoystick->setPosition(238,460);
|
||||
holder._rightJoystick->setPosition(606,293);
|
||||
holder._deviceLabel->setString("Disconnected");
|
||||
}
|
||||
|
||||
|
@ -357,92 +357,92 @@ void GameControllerTest::createControllerSprite(ControllerHolder& holder)
|
|||
holder._holderNode->addChild(controllerBg1);
|
||||
|
||||
auto controllerBg2 = Sprite::create("controller-2.png");
|
||||
controllerBg2->setPosition(Vec2(499,1000));
|
||||
controllerBg2->setPosition(499,1000);
|
||||
controllerBg2->setAnchorPoint(Vec2::ANCHOR_MIDDLE_TOP);
|
||||
holder._holderNode->addChild(controllerBg2);
|
||||
|
||||
holder._leftJoystick = Sprite::create("joystick.png");
|
||||
holder._leftJoystick->setPosition(Vec2(238,460));
|
||||
holder._leftJoystick->setPosition(238,460);
|
||||
holder._holderNode->addChild(holder._leftJoystick);
|
||||
|
||||
holder._rightJoystick = Sprite::create("joystick.png");
|
||||
holder._rightJoystick->setPosition(Vec2(606,293));
|
||||
holder._rightJoystick->setPosition(606,293);
|
||||
holder._holderNode->addChild(holder._rightJoystick);
|
||||
|
||||
holder._deviceLabel = Label::createWithTTF("Disconnected","fonts/Marker Felt.ttf",36);
|
||||
holder._deviceLabel->setPosition(Vec2(499,650));
|
||||
holder._deviceLabel->setPosition(499,650);
|
||||
holder._deviceLabel->setTextColor(Color4B::RED);
|
||||
holder._holderNode->addChild(holder._deviceLabel);
|
||||
|
||||
holder._externalKeyLabel = Label::createWithTTF("Key event","fonts/Marker Felt.ttf",36);
|
||||
holder._externalKeyLabel->setPosition(Vec2(499,500));
|
||||
holder._externalKeyLabel->setPosition(499,500);
|
||||
holder._externalKeyLabel->setTextColor(Color4B::RED);
|
||||
holder._holderNode->addChild(holder._externalKeyLabel);
|
||||
//-----------------------------------------------------------------
|
||||
auto dPadTexture = Director::getInstance()->getTextureCache()->addImage("dPad.png");
|
||||
|
||||
auto dPadCenter = Sprite::createWithTexture(dPadTexture,Rect(60,60,68,68));
|
||||
dPadCenter->setPosition(Vec2(371,294));
|
||||
dPadCenter->setPosition(371,294);
|
||||
holder._holderNode->addChild(dPadCenter);
|
||||
|
||||
holder._dpadLeft = Sprite::createWithTexture(dPadTexture,Rect(0,60,60,60));
|
||||
holder._dpadLeft->setPosition(Vec2(371 - 64,296));
|
||||
holder._dpadLeft->setPosition(371 - 64,296);
|
||||
holder._holderNode->addChild(holder._dpadLeft);
|
||||
|
||||
holder._dpadRight = Sprite::createWithTexture(dPadTexture,Rect(128,60,60,60));
|
||||
holder._dpadRight->setPosition(Vec2(371 + 64,296));
|
||||
holder._dpadRight->setPosition(371 + 64,296);
|
||||
holder._holderNode->addChild(holder._dpadRight);
|
||||
|
||||
holder._dpadUp = Sprite::createWithTexture(dPadTexture,Rect(60,0,60,60));
|
||||
holder._dpadUp->setPosition(Vec2(369,294 + 64));
|
||||
holder._dpadUp->setPosition(369,294 + 64);
|
||||
holder._holderNode->addChild(holder._dpadUp);
|
||||
|
||||
holder._dpadDown = Sprite::createWithTexture(dPadTexture,Rect(60,128,60,60));
|
||||
holder._dpadDown->setPosition(Vec2(369,294 - 64));
|
||||
holder._dpadDown->setPosition(369,294 - 64);
|
||||
holder._holderNode->addChild(holder._dpadDown);
|
||||
//-----------------------------------------------------------------
|
||||
holder._buttonL1 = Sprite::create("L1.png");
|
||||
holder._buttonL1->setPosition(Vec2(290,792));
|
||||
holder._buttonL1->setPosition(290,792);
|
||||
holder._holderNode->addChild(holder._buttonL1);
|
||||
|
||||
holder._buttonR1 = Sprite::create("R1.png");
|
||||
holder._buttonR1->setPosition(Vec2(998 - 290,792));
|
||||
holder._buttonR1->setPosition(998 - 290,792);
|
||||
holder._holderNode->addChild(holder._buttonR1);
|
||||
|
||||
auto buttonL2 = Sprite::create("L2.png");
|
||||
buttonL2->setPosition(Vec2(220,910));
|
||||
buttonL2->setPosition(220,910);
|
||||
holder._holderNode->addChild(buttonL2);
|
||||
|
||||
auto buttonR2 = Sprite::create("R2.png");
|
||||
buttonR2->setPosition(Vec2(998-220,910));
|
||||
buttonR2->setPosition(98-220,910);
|
||||
holder._holderNode->addChild(buttonR2);
|
||||
|
||||
holder._buttonL2 = Sprite::create("L2.png");
|
||||
holder._buttonL2->setOpacity(0);
|
||||
holder._buttonL2->setColor(Color3B::RED);
|
||||
holder._buttonL2->setPosition(Vec2(220,910));
|
||||
holder._buttonL2->setPosition(220,910);
|
||||
holder._holderNode->addChild(holder._buttonL2);
|
||||
|
||||
holder._buttonR2 = Sprite::create("R2.png");
|
||||
holder._buttonR2->setOpacity(0);
|
||||
holder._buttonR2->setColor(Color3B::RED);
|
||||
holder._buttonR2->setPosition(Vec2(998-220,910));
|
||||
holder._buttonR2->setPosition(998-220,910);
|
||||
holder._holderNode->addChild(holder._buttonR2);
|
||||
//-----------------------------------------------------------------
|
||||
holder._buttonX = Sprite::create("X.png");
|
||||
holder._buttonX->setPosition(Vec2(750 - 70,460));
|
||||
holder._buttonX->setPosition(750 - 70,460);
|
||||
holder._holderNode->addChild(holder._buttonX);
|
||||
|
||||
holder._buttonY = Sprite::create("Y.png");
|
||||
holder._buttonY->setPosition(Vec2(750,460 + 70));
|
||||
holder._buttonY->setPosition(750,460 + 70);
|
||||
holder._holderNode->addChild(holder._buttonY);
|
||||
|
||||
holder._buttonA = Sprite::create("A.png");
|
||||
holder._buttonA->setPosition(Vec2(750,460 - 70));
|
||||
holder._buttonA->setPosition(750,460 - 70);
|
||||
holder._holderNode->addChild(holder._buttonA);
|
||||
|
||||
holder._buttonB = Sprite::create("B.png");
|
||||
holder._buttonB->setPosition(Vec2(750 + 70,460));
|
||||
holder._buttonB->setPosition(750 + 70,460);
|
||||
holder._holderNode->addChild(holder._buttonB);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue