在cocos2d-x 3.x版本中,CCProgressTimer类中并没有提供直接设置起始角度的函数。但你可以通过设置精灵的旋转角度来实现类似的效果。

首先,创建一个CCSprite对象并将其设置为CCProgressTimer的显示内容:

auto sprite = Sprite::create("progress.png");
auto progress = ProgressTimer::create(sprite);
progress->setType(ProgressTimer::Type::RADIAL);
progress->setReverseDirection(false);
addChild(progress);

然后,通过设置精灵的旋转角度来设置起始角度:

sprite->setRotation(90); // 设置起始角度为90度

这样,CCProgressTimer的进度条将从90度的位置开始显示。

cocos2dx CCProgressTimer设置起始角度时setStartAngle函数不存在

原文地址: https://www.cveoy.top/t/topic/iQQ8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录