Label1

来源:互联网 发布:pmi指数知乎 编辑:程序博客网 时间:2024/06/07 21:40
local textContent = cc.Label:createWithTTF("", "2.ttf", fontSize) --字符串、ttf字体文件、字体大小
--ttfLabel = cc.Label:create("", activeLayer:GetTtfFont(), 22)    
textContent:setTextVerticalAlignment(cc.TextVAlignment.CENTER) --垂直对齐方式
textContent:setTextHorizontalAlignment(cc.TextHAlignment.LEFT) --水平对齐方式
textContent:setDimensions(520, 520)
textContent:enableOutline(cc.c4b(87, 0, 0, 255), 1.5) --描边
textContent:setAnchorPoint(cc.p(0,0.5)) --锚点
--中间(0.5f, 0.5f);
--左下角(0.0f, 0.0f);
--左上角(0.0f, 1.0f);
--右下角(1.0f, 0.0f);
--右上角(1.0f, 1.0f);
--右中间(1.0f, 0.5f);
--左中间(0.0f, 0.5f);
--上中间(0.5f, 1.0f);
--下中间(0.5f, 0.0f);
textContent:setPosition(620, 300)
layer:addChild(textContent)
------------------------------Label2--------------------------------
local textContent = cc.Label:create("", "2.ttf", fontSize) --字符串、ttf字体文件、字体大小
textContent:setAlignment(cc.TEXT_ALIGNMENT_LEFT,cc.VERTICAL_TEXT_ALIGNMENT_CENTER)
-- textContent:setHorizontalAlignment(1)
-- textContent:setVerticalAlignment(1)
textContent:setDimensions(520, 520)
textContent:setTextColor(cc.c4b(0xff, 0xf6, 0x00, 0xff))
textContent:setVisible(false)
textContent:enableBold()
textContent:setSkewX(15)
textContent:setAdditionalKerning(-2)
textContent:enableOutline(cc.c4b(87, 0, 0, 255), 1.5) --描边
textContent:setAnchorPoint(cc.p(0,0.5)) --锚点
textContent:enableShadow(cc.c4b(0, 0, 0, 255), cc.size(0, -1),0)
--中间(0.5f, 0.5f);
--左下角(0.0f, 0.0f);
--左上角(0.0f, 1.0f);
--右下角(1.0f, 0.0f);
--右上角(1.0f, 1.0f);
--右中间(1.0f, 0.5f);
--左中间(0.0f, 0.5f);
--上中间(0.5f, 1.0f);
--下中间(0.5f, 0.0f);
textContent:setPosition(620, 300)
layer:addChild(textContent)
原创粉丝点击