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;

}

 

相关文章:

  • 2021-12-26
  • 2021-04-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-07-04
  • 2022-12-23
  • 2022-01-02
猜你喜欢
  • 2021-06-19
  • 2021-12-12
  • 2021-12-19
  • 2021-12-11
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案