CCLableIBMFont 操作文本中单个字符
来源:互联网 发布:谷歌读屏软件下载 编辑:程序博客网 时间:2024/06/05 15:50
CCLableIBMFont 内部采用的是 CCSpriteBatchNode来渲染图片的。使用该控件需要提供一个字体文件.fnt,并且要有对应文件名的png。
例子:
// Upper Label
CCLabelBMFont *label = CCLabelBMFont::create("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt");
addChild(label);
CCSize s = CCDirector::sharedDirector()->getWinSize();
label->setPosition( ccp(s.width/2, s.height/2) );
label->setAnchorPoint( ccp(0.5f, 0.5f) );
//获取文本中的单个字符
CCSprite* BChar = (CCSprite*) label->getChildByTag(0);
CCSprite* FChar = (CCSprite*) label->getChildByTag(7);
CCSprite* AChar = (CCSprite*) label->getChildByTag(12);
CCActionInterval* rotate = CCRotateBy::create(2, 360);
CCAction* rot_4ever = CCRepeatForever::create(rotate);
CCActionInterval* scale = CCScaleBy::create(2, 1.5f);
CCActionInterval* scale_back = scale->reverse();
CCSequence* scale_seq = CCSequence::create(scale, scale_back,NULL);
CCAction* scale_4ever = CCRepeatForever::create(scale_seq);
CCActionInterval* jump = CCJumpBy::create(0.5f, CCPointZero, 60, 1);
CCAction* jump_4ever = CCRepeatForever::create(jump);
CCActionInterval* fade_out = CCFadeOut::create(1);
CCActionInterval* fade_in = CCFadeIn::create(1);
CCSequence* seq = CCSequence::create(fade_out, fade_in, NULL);
CCAction* fade_4ever = CCRepeatForever::create(seq);
//操作单个字符,并给出不同的动作
BChar->runAction(rot_4ever);
BChar->runAction(scale_4ever);
FChar->runAction(jump_4ever);
AChar->runAction(fade_4ever);
// Bottom Label
CCLabelBMFont *label2 = CCLabelBMFont::create("00.0", "fonts/bitmapFontTest.fnt");
addChild(label2, 0, kTagBitmapAtlas2);
label2->setPosition( ccp(s.width/2.0f, 80) );
CCSprite* lastChar = (CCSprite*) label2->getChildByTag(3);
lastChar->runAction( (CCAction*)(rot_4ever->copy()->autorelease()) );
截图:
- CCLableIBMFont 操作文本中单个字符
- single character replace program 文本中单个字符的替换,支持一些特殊的字符。
- charaster---string单个字符操作
- java中单个字符输入输出
- 字符文本操作类
- 字符串中单个字符的用法
- 查找字符串中单个字符个数
- c中单个字符所占字节
- JavaScript 中匹配单个字符实例
- java中实现键盘录入单个字符
- python-文件操作seek(单个字符替换)
- 文本中字符个数统计
- 错误:字符文本中字符太多
- c# 中操作文本
- 批量修改单元格中单个字符的颜色(VBA)
- 如何将编辑框中内容转成单个字符输出
- 编写一个函数,实现字符串中,单个字符的删除
- C-关于结构体中字符数组的单个赋值
- Ubuntu下配置samba实现文件夹共享
- MATLAB入门教程
- 1085. Perfect Sequence (25)
- Android XListView实现原理讲解及分析
- 对话框添加菜单
- CCLableIBMFont 操作文本中单个字符
- OpenCv_Image与光流法中设置ROI区域
- java socket编程
- TCP/IP
- 实现sqrt()开方运算
- android上运行python
- div最小高度
- 后台管理用户权限数据库设计
- 对象引用与变量赋值