cc.LabelAtlas实现的Hello World文字
cc.LabelAtlas实现的Hello World文字主要代码如下:var HelloWorldLayer = cc.Layer.extend({ sprite:null, ctor:function () { this._super(); …… // 创建并初始化标签 var helloLabel = new cc.LabelAtlas("Hello World", res.charmap_png, 48, 66, " "); ① helloLabel.x = size.width / 2 - helloLabel.getContentSize().width / 2; helloLabel.y = size.height - helloLabel.getContentSize().height; this.addChild(helloLabel, 5); …… return true; } });
var res = { HelloWorld_png : "res/HelloWorld.png", CloseNormal_png : "res/CloseNormal.png", CloseSelected_png : "res/CloseSelected.png", charmap_png : "res/fonts/tuffy_bold_italic-charmap.png" };
《Cocos2d-x实战 JS卷》现已上线,各大商店均已开售:
京东:http://item.
原文:http://blog.csdn.net/tonny_guan/article/details/44535593