bool HelloWorld::init()
{
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
_angle=0;
auto dot=DrawNode::create();
dot->drawDot(Vec2(0,0),10,Color4F(1.0,1.0,1.0,1.0));
addChild(dot);
dot->setPosition(visibleSize/2);
schedule([dot,this,visibleSize](float f){
dot->setPositionY(visibleSize.height/2+sin(_angle)*100.0);
dot->setPositionX(visibleSize.width/2+cos(_angle)*100.0);
_angle+=0.1;
},"Test");
return true;
}
时间: 2024-09-30 10:07:07