学习4-Cocos2D-X UI系统

已经学了好几节了,现在把UI系统的笔记再整一下。

Cocos2D-X UI系统我学习的有:字体、标签、菜单、进度条、计时器。

1、字体

2、标签

3、菜单

4、进度条

5、计时器

其实小牛在写这个笔记的时候,已经把cocos2dx的基础篇学习完了,现在就当是做一个基础巩固。
其实小牛是个菜鸟……

小牛在认识系统中基础UI的时候,用了几个字体标签的组件:

<span style="white-space:pre">	</span>CCSize s = CCDirector::sharedDirector()->getWinSize();
	CCLabelTTF* ttfFont = CCLabelTTF::create("Hello World","Arial",24);
	addChild(ttfFont);
	ttfFont->setPosition(ccp(s.width/2,s.height/2));
	ttfFont->setString("Hello cocos2dx");
	ttfFont->setColor(ccc3(255,0));
	ttfFont->setScale(3.0f);
	ttfFont->setRotation(45.f);
	
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	CCLabelBMFont* bmfFont = CCLabelBMFont::create("1234","fonts/bitmapFontChinese.fnt");
	addChild(bmfFont);
	bmfFont->setPosition(ccp(s.width/2,s.height/2));
	bmfFont->setColor(ccc3(255,0));
	//bmfFont->setScale(3.0f);
	//bmfFont->setRotation(45.f);
	
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	CCLabelAtlas* atlasFont = CCLabelAtlas::create("123","fonts/labelatlas.png",32,96);
	addChild(atlasFont);
	atlasFont->setPosition(ccp(s.width/2,s.height/2));
	
其中本来想写中文,可发现中文显示出来的都是乱码,后来在百度上查了一下中文的问题,发现是个很麻烦的问题,解决办法点这里

小牛也是水平太low了,没有实现就往下学习了。

小牛在csdn这个强大的blog中找到各种优秀文章,在此就做一个记录咯!

进度条的使用-> 点这里

小牛也是着急,这做个小游戏怎么这么难……


CCSize s = CCDirector::sharedDirector()->getWinSize();
	CCLabelTTF* ttfFont = CCLabelTTF::create("Hello World",s.height/2));
	
用起来有些不顺手,毕竟第一次使用……

相关文章

    本文实践自 RayWenderlich、Ali Hafizji 的文章《...
Cocos-code-ide使用入门学习地点:杭州滨江邮箱:appdevzw@1...
第一次開始用手游引擎挺激动!!!进入正题。下载资源1:从C...
    Cocos2d-x是一款强大的基于OpenGLES的跨平台游戏开发...
1.  来源 QuickV3sample项目中的2048样例游戏,以及最近《...
   Cocos2d-x3.x已经支持使用CMake来进行构建了,这里尝试...