在 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 度的位置开始显示。

Cocos2d-x 3.x 中 CCProgressTimer 设置起始角度方法

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

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