cocos2d 制作5星评分效果
来源:互联网 发布:最终幻想14捏脸数据 编辑:程序博客网 时间:2024/05/16 16:08
做的是一个评分的展示,不涉及评分的操作
cocos2dx 3.0+
效果如下,分别为8.6分,5分和10分
五角星图片原图
代码片段
for (int i = 0; i < (int)score / 2; i++){auto starImg = Sprite::create("appstore/applist/star_full.png");starImg->setAnchorPoint(Point::ANCHOR_TOP_LEFT);starImg->setPosition(26 + i * 35, 48);_detailHolder->addChild(starImg, POSTER_LAYER);}float percent = score/2 - (int)score/2;if ( percent != 0){auto starImg = Sprite::create("appstore/applist/star_empty.png");starImg->setAnchorPoint(Point::ANCHOR_TOP_LEFT);starImg->setPosition(26 + (int)score / 2 * 35 + starImg->getContentSize().width * percent, 48);starImg->setTextureRect(Rect(starImg->getContentSize().width * percent, 0, starImg->getContentSize().width - starImg->getContentSize().width * percent, starImg->getContentSize().height));_detailHolder->addChild(starImg, POSTER_LAYER);auto starImg2 = Sprite::create("appstore/applist/star_full.png");starImg2->setAnchorPoint(Point::ANCHOR_TOP_LEFT);starImg2->setPosition(26 + (int)score / 2 * 35, 48);starImg2->setTextureRect(Rect(0, 0, starImg2->getContentSize().width * percent, starImg2->getContentSize().height));_detailHolder->addChild(starImg2, POSTER_LAYER);}
http://blog.sina.com.cn/s/blog_65be11bd0101o8ou.html
0 0
- cocos2d 制作5星评分效果
- Cocos2d-X 雪花效果制作
- cocos2d制作动态光晕效果
- cocos2d制作动态光晕效果基础
- jquery 制作评分控件
- 迅雷评分效果
- 五角星动态评分效果
- 网站星星评分效果
- 网上商城五星评分效果
- js评分效果
- 百度文库评分效果
- 星星评分效果
- cocos2d 制作动态光晕效果基础 —— blendFunc
- cocos2d制作动态光晕效果基础——blendFunc
- cocos2d制作动态光晕效果基础——blendFunc
- cocos2d 制作动态光晕效果基础 —— blendFunc
- cocos2d 制作动态光晕效果基础 —— blendFunc(精)
- cocos2d 制作动态光晕效果基础 —— blendFunc
- 官方 Hadoop 2.5.2 命令参考(中文翻译版)
- 登录重放攻击预防
- Session的生命周期
- EJB入门
- 1019. 数字黑洞
- cocos2d 制作5星评分效果
- hdu 3622 Bomb Game
- 改进的筛素数法
- linux下搭建SVN服务器以及遇到的常见问题解决
- hadoop学习笔记
- Hadoop2.2.0完全分布式集群平台安装与设置
- dubbo中遇到的问题(一)
- 改进的筛素数
- OpCode 笔记