mirror of https://github.com/axmolengine/axmol.git
Vector2 replaced by Vec2
This commit is contained in:
parent
ef3263e80d
commit
64fa90ff0f
|
@ -28,7 +28,7 @@ bool HelloWorld::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||||
Vector2 origin = Director::getInstance()->getVisibleOrigin();
|
Vec2 origin = Director::getInstance()->getVisibleOrigin();
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// 2. add a menu item with "X" image, which is clicked to quit the program
|
// 2. add a menu item with "X" image, which is clicked to quit the program
|
||||||
|
@ -40,12 +40,12 @@ bool HelloWorld::init()
|
||||||
"CloseSelected.png",
|
"CloseSelected.png",
|
||||||
CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
|
CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
|
||||||
|
|
||||||
closeItem->setPosition(Vector2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
|
closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
|
||||||
origin.y + closeItem->getContentSize().height/2));
|
origin.y + closeItem->getContentSize().height/2));
|
||||||
|
|
||||||
// create menu, it's an autorelease object
|
// create menu, it's an autorelease object
|
||||||
auto menu = Menu::create(closeItem, NULL);
|
auto menu = Menu::create(closeItem, NULL);
|
||||||
menu->setPosition(Vector2::ZERO);
|
menu->setPosition(Vec2::ZERO);
|
||||||
this->addChild(menu, 1);
|
this->addChild(menu, 1);
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
@ -57,7 +57,7 @@ bool HelloWorld::init()
|
||||||
auto label = LabelTTF::create("Hello World", "Arial", 24);
|
auto label = LabelTTF::create("Hello World", "Arial", 24);
|
||||||
|
|
||||||
// position the label on the center of the screen
|
// position the label on the center of the screen
|
||||||
label->setPosition(Vector2(origin.x + visibleSize.width/2,
|
label->setPosition(Vec2(origin.x + visibleSize.width/2,
|
||||||
origin.y + visibleSize.height - label->getContentSize().height));
|
origin.y + visibleSize.height - label->getContentSize().height));
|
||||||
|
|
||||||
// add the label as a child to this layer
|
// add the label as a child to this layer
|
||||||
|
@ -67,7 +67,7 @@ bool HelloWorld::init()
|
||||||
auto sprite = Sprite::create("HelloWorld.png");
|
auto sprite = Sprite::create("HelloWorld.png");
|
||||||
|
|
||||||
// position the sprite on the center of the screen
|
// position the sprite on the center of the screen
|
||||||
sprite->setPosition(Vector2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
|
sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
|
||||||
|
|
||||||
// add the sprite as a child to this layer
|
// add the sprite as a child to this layer
|
||||||
this->addChild(sprite, 0);
|
this->addChild(sprite, 0);
|
||||||
|
|
Loading…
Reference in New Issue