读书人

根本控件

发布时间: 2013-12-02 12:00:40 作者: rapoo

基本控件
CCLayerColor 颜色控件

//对应参数//1 颜色。 2 宽度 3高度//anchior默认是左下角CCLayerColor *cc = CCLayerColor::create(ccc4(255,0,0,128),200, 100);cc->changeWidthAndHeight(299, 100);ccc->setColor(ccc3(0,255,0));ccc->setOpacity(255);


CCLayerGradient 渐变颜色控件
CCLayerGradient *gradient = CCLayerGradient::create(ccc4(255,0,0,255), ccc4(0,255,0,255), ccp(1,1)); //第3个参数是渐变的方向


文字控件
//字体选择 Lisu, SimSun, Microsoft YaHeiCCLabelTTF *label = CCLabelTTF::create("Hello", "Lisu", 50);label->setColor(ccc3(255,255,0));CCLabelTTF *label1 = CCLabelTTF::create("Hello","SimSun", 50, CCSize(480, 320), kCCTextAlignmentLeft, KCCVerticalTextAlignmentCenter);//最后2个参数。左对齐和垂直居中

中文字体会有乱码出现。解决方法是把文字写进一个文档,统一读取


读书人网 >移动开发

热点推荐