Replace cc.LabelBMFont:create with cc.Label:createBMFont

This commit is contained in:
samuele3hu 2014-03-12 18:33:28 +08:00
parent c69d9e75b2
commit 9713a246ee
7 changed files with 37 additions and 21 deletions

View File

@ -37,12 +37,12 @@ local function showFont(ret, pFont)
ret:removeChildByTag(kTagLabel3, true) ret:removeChildByTag(kTagLabel3, true)
ret:removeChildByTag(kTagLabel4, true) ret:removeChildByTag(kTagLabel4, true)
local top = cc.LabelTTF:create(pFont, pFont, 24) local top = cc.Label:create(pFont, pFont, 24)
local left = cc.LabelTTF:create("alignment left", pFont, fontSize, local left = cc.Label:create("alignment left", pFont, fontSize,
blockSize, cc.TEXT_ALIGNMENT_LEFT, verticalAlignment[vAlignIdx]) blockSize, cc.TEXT_ALIGNMENT_LEFT, verticalAlignment[vAlignIdx])
local center = cc.LabelTTF:create("alignment center", pFont, fontSize, local center = cc.Label:create("alignment center", pFont, fontSize,
blockSize, cc.TEXT_ALIGNMENT_CENTER, verticalAlignment[vAlignIdx]) blockSize, cc.TEXT_ALIGNMENT_CENTER, verticalAlignment[vAlignIdx])
local right = cc.LabelTTF:create("alignment right", pFont, fontSize, local right = cc.Label:create("alignment right", pFont, fontSize,
blockSize, cc.TEXT_ALIGNMENT_RIGHT, verticalAlignment[vAlignIdx]) blockSize, cc.TEXT_ALIGNMENT_RIGHT, verticalAlignment[vAlignIdx])
local leftColor = cc.LayerColor:create(cc.c4b(100, 100, 100, 255), blockSize.width, blockSize.height) local leftColor = cc.LayerColor:create(cc.c4b(100, 100, 100, 255), blockSize.width, blockSize.height)

View File

@ -23,11 +23,16 @@ local function IntervalLayer()
ret:addChild(sun) ret:addChild(sun)
-- timers -- timers
m_label0 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt") m_label0 = cc.Label:createWithBMFont("fonts/bitmapFontTest4.fnt", "0")
m_label1 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt") m_label0:setAnchorPoint(cc.p(0.5, 0.5))
m_label2 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt") m_label1 = cc.Label:createWithBMFont("fonts/bitmapFontTest4.fnt", "0")
m_label3 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt") m_label1:setAnchorPoint(cc.p(0.5, 0.5))
m_label4 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt") m_label2 = cc.Label:createWithBMFont("fonts/bitmapFontTest4.fnt", "0")
m_label2:setAnchorPoint(cc.p(0.5, 0.5))
m_label3 = cc.Label:createWithBMFont("fonts/bitmapFontTest4.fnt", "0")
m_label3:setAnchorPoint(cc.p(0.5, 0.5))
m_label4 = cc.Label:createWithBMFont("fonts/bitmapFontTest4.fnt", "0")
m_label4:setAnchorPoint(cc.p(0.5, 0.5))
local function update(dt) local function update(dt)
m_time0 = m_time0 + dt m_time0 = m_time0 + dt

View File

@ -68,7 +68,8 @@ local function LayerTestCascadingOpacityA()
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png") local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png") local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt", "Test")
label:setAnchorPoint(cc.p(0.5, 0.5))
layer1:addChild(sister1) layer1:addChild(sister1)
layer1:addChild(sister2) layer1:addChild(sister2)
@ -109,7 +110,8 @@ local function LayerTestCascadingOpacityB()
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png") local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png") local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt","Test")
label:setAnchorPoint(cc.p(0.5, 0.5))
layer1:addChild(sister1) layer1:addChild(sister1)
layer1:addChild(sister2) layer1:addChild(sister2)
@ -142,7 +144,8 @@ local function LayerTestCascadingOpacityC()
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png") local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png") local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt","Test")
label:setAnchorPoint(cc.p(0.5, 0.5))
layer1:addChild(sister1) layer1:addChild(sister1)
layer1:addChild(sister2) layer1:addChild(sister2)
@ -172,7 +175,8 @@ local function LayerTestCascadingColorA()
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png") local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png") local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt","Test")
label:setAnchorPoint(cc.p(0.5, 0.5))
layer1:addChild(sister1) layer1:addChild(sister1)
layer1:addChild(sister2) layer1:addChild(sister2)
@ -218,7 +222,8 @@ local function LayerTestCascadingColorB()
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png") local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png") local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt","Test")
label:setAnchorPoint(cc.p(0.5, 0.5))
layer1:addChild(sister1) layer1:addChild(sister1)
layer1:addChild(sister2) layer1:addChild(sister2)
@ -263,7 +268,8 @@ local function LayerTestCascadingColorC()
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png") local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png") local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt","Test")
label:setAnchorPoint(cc.p(0.5, 0.5))
layer1:addChild(sister1) layer1:addChild(sister1)
layer1:addChild(sister2) layer1:addChild(sister2)

View File

@ -89,7 +89,8 @@ local function MenuLayerMainMenu()
end end
-- Label Item (cc.LabelBMFont) -- Label Item (cc.LabelBMFont)
local label = cc.LabelBMFont:create("configuration", "fonts/bitmapFontTest3.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest3.fnt", "configuration")
label:setAnchorPoint(cc.p(0.5, 0.5))
local item5 = cc.MenuItemLabel:create(label) local item5 = cc.MenuItemLabel:create(label)
item5:registerScriptTapHandler(menuCallbackConfig) item5:registerScriptTapHandler(menuCallbackConfig)
@ -321,7 +322,8 @@ local function MenuLayer3()
cc.MenuItemFont:setFontName("Marker Felt") cc.MenuItemFont:setFontName("Marker Felt")
cc.MenuItemFont:setFontSize(28) cc.MenuItemFont:setFontSize(28)
local label = cc.LabelBMFont:create("Enable AtlasItem", "fonts/bitmapFontTest3.fnt") local label = cc.Label:createWithBMFont("fonts/bitmapFontTest3.fnt", "Enable AtlasItem")
label:setAnchorPoint(cc.p(0.5, 0.5))
local item1 = cc.MenuItemLabel:create(label) local item1 = cc.MenuItemLabel:create(label)
item1:registerScriptTapHandler(menuCallback2) item1:registerScriptTapHandler(menuCallback2)
@ -446,7 +448,8 @@ local function MenuLayer4()
cc.MenuItemFont:setFontName( "Marker Felt" ) cc.MenuItemFont:setFontName( "Marker Felt" )
cc.MenuItemFont:setFontSize( 34 ) cc.MenuItemFont:setFontSize( 34 )
local label = cc.LabelBMFont:create( "go back", "fonts/bitmapFontTest3.fnt" ) local label = cc.Label:createWithBMFont("fonts/bitmapFontTest3.fnt", "go back")
label:setAnchorPoint(cc.p(0.5, 0.5))
local back = cc.MenuItemLabel:create(label) local back = cc.MenuItemLabel:create(label)
back:registerScriptTapHandler(backCallback) back:registerScriptTapHandler(backCallback)

View File

@ -166,7 +166,8 @@ local function OpenGLTestMainLayer()
program:link() program:link()
program:updateUniforms() program:updateUniforms()
label = cc.LabelBMFont:create("RETRO EFFECT","fonts/west_england-64.fnt") label = cc.Label:createWithBMFont("fonts/west_england-64.fnt", "RETRO EFFECT")
label:setAnchorPoint(cc.p(0.5, 0.5))
label:setShaderProgram( program ) label:setShaderProgram( program )
label:setPosition(size.width/2, size.height/2) label:setPosition(size.width/2, size.height/2)

View File

@ -1613,7 +1613,8 @@ local function runTouchesTest()
pLayer:scheduleUpdateWithPriorityLua(update,0) pLayer:scheduleUpdateWithPriorityLua(update,0)
pClassLabel = cc.LabelBMFont:create("00.0", "fonts/arial16.fnt") pClassLabel = cc.Label:createWithBMFont("fonts/arial16.fnt", "00.0")
pClassLabel:setAnchorPoint(cc.p(0.5, 0.5))
pClassLabel:setPosition(cc.p(s.width/2, s.height/2)) pClassLabel:setPosition(cc.p(s.width/2, s.height/2))
pLayer:addChild(pClassLabel) pLayer:addChild(pClassLabel)

View File

@ -126,7 +126,7 @@ local function XMLHttpRequestLayer()
labelStatusCode:setString("waiting...") labelStatusCode:setString("waiting...")
end end
local labelPostJson = cc.LabelTTF:create("Test Post Json", s_arialPath, 22) local labelPostJson = cc.Label:create("Test Post Json", s_arialPath, 22)
labelPostJson:setAnchorPoint(cc.p(0.5, 0.5)) labelPostJson:setAnchorPoint(cc.p(0.5, 0.5))
local itemPostJson = cc.MenuItemLabel:create(labelPostJson) local itemPostJson = cc.MenuItemLabel:create(labelPostJson)
itemPostJson:registerScriptTapHandler(onMenuPostJsonClicked) itemPostJson:registerScriptTapHandler(onMenuPostJsonClicked)