mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6239 from boyu0/label_create_refactor
Rename lua cc.Label:create to cc.Label:createWithTTF and cc.Label:create...
This commit is contained in:
commit
cc0147adfe
|
@ -7,7 +7,7 @@ local function AccelerometerMainLayer()
|
|||
|
||||
local function onEnter()
|
||||
layer:setAccelerometerEnabled(true)
|
||||
local label = cc.Label:create(title(), "fonts/arial.ttf", 32)
|
||||
local label = cc.Label:createWithTTF(title(), "fonts/arial.ttf", 32)
|
||||
layer:addChild(label, 1)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 50) )
|
||||
|
|
|
@ -68,7 +68,7 @@ local function PauseTest()
|
|||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local l = cc.Label:create("After 3 seconds grossini should move", "fonts/Thonburi.ttf", 16)
|
||||
local l = cc.Label:createWithTTF("After 3 seconds grossini should move", "fonts/Thonburi.ttf", 16)
|
||||
ret:addChild(l)
|
||||
l:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
l:setPosition( cc.p(s.width / 2, 245) )
|
||||
|
@ -102,7 +102,7 @@ end
|
|||
--------------------------------------------------------------------
|
||||
local function RemoveTest()
|
||||
local ret = createTestLayer("Remove Test")
|
||||
local l = cc.Label:create("Should not crash", "fonts/Thonburi.ttf", 16)
|
||||
local l = cc.Label:createWithTTF("Should not crash", "fonts/Thonburi.ttf", 16)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
ret:addChild(l)
|
||||
l:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
|
@ -147,7 +147,7 @@ local function ResumeTest()
|
|||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
local l = cc.Label:create("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16)
|
||||
local l = cc.Label:createWithTTF("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16)
|
||||
ret:addChild(l)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
l:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
|
|
|
@ -198,7 +198,7 @@ local function SpriteProgressBarTintAndFade()
|
|||
left:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.TintTo:create(1, 255, 0, 0), cc.TintTo:create(1, 0, 255, 0), cc.TintTo:create(1, 0, 0, 255))))
|
||||
layer:addChild(left)
|
||||
|
||||
left:addChild(cc.Label:create("Tint", "fonts/Marker Felt.ttf", 20.0))
|
||||
left:addChild(cc.Label:createWithTTF("Tint", "fonts/Marker Felt.ttf", 20.0))
|
||||
|
||||
local middle = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
middle:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
|
@ -213,7 +213,7 @@ local function SpriteProgressBarTintAndFade()
|
|||
middle:runAction(cc.RepeatForever:create(fade2))
|
||||
layer:addChild(middle)
|
||||
|
||||
middle:addChild(cc.Label:create("Fade", "fonts/Marker Felt.ttf", 20.0))
|
||||
middle:addChild(cc.Label:createWithTTF("Fade", "fonts/Marker Felt.ttf", 20.0))
|
||||
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
|
@ -227,7 +227,7 @@ local function SpriteProgressBarTintAndFade()
|
|||
right:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(1.0, 0), cc.FadeTo:create(1.0, 255))))
|
||||
layer:addChild(right)
|
||||
|
||||
right:addChild(cc.Label:create("Tint and Fade", "fonts/Marker Felt.ttf", 20.0))
|
||||
right:addChild(cc.Label:createWithTTF("Tint and Fade", "fonts/Marker Felt.ttf", 20.0))
|
||||
|
||||
Helper.subtitleLabel:setString("ProgressTo Bar Mid")
|
||||
return layer
|
||||
|
|
|
@ -184,7 +184,7 @@ local function ActionRotationalSkewVSStandardSkew()
|
|||
box:ignoreAnchorPointForPosition(false);
|
||||
box:setPosition(cc.p(s.width/2, s.height - 100 - box:getContentSize().height/2));
|
||||
layer:addChild(box);
|
||||
local label = cc.Label:create("Standard cocos2d Skew", s_markerFeltFontPath, 16);
|
||||
local label = cc.Label:createWithTTF("Standard cocos2d Skew", s_markerFeltFontPath, 16);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p(s.width/2, s.height - 100 + label:getContentSize().height));
|
||||
layer:addChild(label);
|
||||
|
@ -200,7 +200,7 @@ local function ActionRotationalSkewVSStandardSkew()
|
|||
box:ignoreAnchorPointForPosition(false);
|
||||
box:setPosition(cc.p(s.width/2, s.height - 250 - box:getContentSize().height/2));
|
||||
layer:addChild(box);
|
||||
label = cc.Label:create("Rotational Skew", s_markerFeltFontPath, 16);
|
||||
label = cc.Label:createWithTTF("Rotational Skew", s_markerFeltFontPath, 16);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p(s.width/2, s.height - 250 + label:getContentSize().height/2));
|
||||
layer:addChild(label);
|
||||
|
@ -590,7 +590,7 @@ end
|
|||
local actionSequenceLayer = nil
|
||||
|
||||
local function ActionSequenceCallback1()
|
||||
local label = cc.Label:create("callback 1 called", s_markerFeltFontPath, 16)
|
||||
local label = cc.Label:createWithTTF("callback 1 called", s_markerFeltFontPath, 16)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(size.width / 4, size.height / 2)
|
||||
|
||||
|
@ -598,7 +598,7 @@ local function ActionSequenceCallback1()
|
|||
end
|
||||
|
||||
local function ActionSequenceCallback2(sender)
|
||||
local label = cc.Label:create("callback 2 called", s_markerFeltFontPath, 16)
|
||||
local label = cc.Label:createWithTTF("callback 2 called", s_markerFeltFontPath, 16)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p(size.width / 4 * 2, size.height / 2))
|
||||
|
||||
|
@ -606,7 +606,7 @@ local function ActionSequenceCallback2(sender)
|
|||
end
|
||||
|
||||
local function ActionSequenceCallback3(sender)
|
||||
local label = cc.Label:create("callback 3 called", s_markerFeltFontPath, 16)
|
||||
local label = cc.Label:createWithTTF("callback 3 called", s_markerFeltFontPath, 16)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p(size.width / 4 * 3, size.height / 2))
|
||||
|
||||
|
@ -789,7 +789,7 @@ end
|
|||
local callFuncLayer = nil
|
||||
|
||||
local function CallFucnCallback1()
|
||||
local label = cc.Label:create("callback 1 called", s_markerFeltFontPath, 16)
|
||||
local label = cc.Label:createWithTTF("callback 1 called", s_markerFeltFontPath, 16)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(size.width / 4, size.height / 2)
|
||||
|
||||
|
@ -797,7 +797,7 @@ local function CallFucnCallback1()
|
|||
end
|
||||
|
||||
local function CallFucnCallback2(sender)
|
||||
local label = cc.Label:create("callback 2 called", s_markerFeltFontPath, 16)
|
||||
local label = cc.Label:createWithTTF("callback 2 called", s_markerFeltFontPath, 16)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(size.width / 4 * 2, size.height / 2)
|
||||
|
||||
|
@ -805,7 +805,7 @@ local function CallFucnCallback2(sender)
|
|||
end
|
||||
|
||||
local function CallFucnCallback3(sender)
|
||||
local label = cc.Label:create("callback 3 called", s_markerFeltFontPath, 16)
|
||||
local label = cc.Label:createWithTTF("callback 3 called", s_markerFeltFontPath, 16)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(size.width / 4 * 3, size.height / 2)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ function AssetManagerModule.newScene(backfunc)
|
|||
backMenu:addChild(backMenuItem)
|
||||
layer:addChild(backMenu,6)
|
||||
|
||||
local helloLabel = cc.Label:create("Hello World", s_arialPath, 38)
|
||||
local helloLabel = cc.Label:createWithTTF("Hello World", s_arialPath, 38)
|
||||
helloLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
helloLabel:setPosition(cc.p(winSize.width / 2, winSize.height - 40))
|
||||
layer:addChild(helloLabel, 5)
|
||||
|
|
|
@ -35,7 +35,7 @@ local function updateLayer()
|
|||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
|
||||
local progressLable = cc.Label:create("",s_arialPath,30)
|
||||
local progressLable = cc.Label:createWithTTF("",s_arialPath,30)
|
||||
progressLable:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
progressLable:setPosition(cc.p(140,50))
|
||||
layer:addChild(progressLable)
|
||||
|
|
|
@ -90,7 +90,7 @@ local function BugTest458()
|
|||
|
||||
local function InitQuestionContainerSprite(pSprite)
|
||||
--Add label
|
||||
local pLabel = cc.Label:create("Answer 1", s_arialPath, 12)
|
||||
local pLabel = cc.Label:createWithTTF("Answer 1", s_arialPath, 12)
|
||||
pLabel:setAnchorPoint(cc.p(0.5,0.5))
|
||||
pLabel:setTag(100)
|
||||
|
||||
|
@ -190,7 +190,7 @@ local BugTest624_2_entry = nil
|
|||
local function BugTest624()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local pLabel = cc.Label:create("Layer1", s_markerFeltFontPath, 36)
|
||||
local pLabel = cc.Label:createWithTTF("Layer1", s_markerFeltFontPath, 36)
|
||||
pLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pLabel:setPosition(cc.p(Winsize.width / 2, Winsize.height / 2))
|
||||
pLayer:addChild(pLabel)
|
||||
|
@ -230,7 +230,7 @@ end
|
|||
function BugTest624_2()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local pLabel = cc.Label:create("Layer2", s_markerFeltFontPath, 36)
|
||||
local pLabel = cc.Label:createWithTTF("Layer2", s_markerFeltFontPath, 36)
|
||||
pLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pLabel:setPosition(cc.p(Winsize.width / 2, Winsize.height / 2))
|
||||
pLayer:addChild(pLabel)
|
||||
|
@ -319,7 +319,7 @@ local function BugTest914()
|
|||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local label = cc.Label:create("Hello World", s_markerFeltFontPath, 64)
|
||||
local label = cc.Label:createWithTTF("Hello World", s_markerFeltFontPath, 64)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
--position the label on the center of the screen
|
||||
label:setPosition(cc.p( Winsize.width /2 , Winsize.height/2 ))
|
||||
|
@ -382,7 +382,7 @@ local function BugTest1159()
|
|||
pScene:addChild(pLayer)
|
||||
cc.Director:getInstance():replaceScene(cc.TransitionPageTurn:create(1.0, pScene, false))
|
||||
end
|
||||
local label = cc.MenuItemLabel:create(cc.Label:create("Flip Me", "Helvetica", 24))
|
||||
local label = cc.MenuItemLabel:createWithSystemFont(cc.Label:createWithSystemFont("Flip Me", "Helvetica", 24))
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:registerScriptTapHandler(menuCallback)
|
||||
local menu = cc.Menu:create()
|
||||
|
@ -594,7 +594,7 @@ local function BugsTestMainLayer()
|
|||
|
||||
local i = 1
|
||||
for i = 1, nTestCount do
|
||||
local label = cc.Label:create(testNames[i], s_arialPath, 24)
|
||||
local label = cc.Label:createWithTTF(testNames[i], s_arialPath, 24)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local pMenuItem = cc.MenuItemLabel:create(label)
|
||||
pMenuItem:registerScriptTapHandler(menuCallback)
|
||||
|
|
|
@ -195,14 +195,14 @@ function ArmatureTestLayer:createToExtensionMenu()
|
|||
end
|
||||
|
||||
function ArmatureTestLayer:creatTitleAndSubTitle(idx)
|
||||
local title = cc.Label:create(ArmatureTestLayer.title(idx), s_arialPath, 18)
|
||||
local title = cc.Label:createWithTTF(ArmatureTestLayer.title(idx), s_arialPath, 18)
|
||||
title:setColor(cc.c3b(0,0,0))
|
||||
self:addChild(title, 1, 10000)
|
||||
title:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30))
|
||||
local subTitle = nil
|
||||
if "" ~= ArmatureTestLayer.subTitle(idx) then
|
||||
local subTitle = cc.Label:create(ArmatureTestLayer.subTitle(idx), s_arialPath, 18)
|
||||
local subTitle = cc.Label:createWithTTF(ArmatureTestLayer.subTitle(idx), s_arialPath, 18)
|
||||
subTitle:setColor(cc.c3b(0,0,0))
|
||||
self:addChild(subTitle, 1, 10001)
|
||||
subTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
|
@ -228,7 +228,7 @@ function TestAsynchronousLoading:onEnter()
|
|||
self._restarItem:setEnabled(false)
|
||||
self._nextItem:setEnabled(false)
|
||||
|
||||
local title = cc.Label:create(ArmatureTestLayer.title(1), s_arialPath, 18)
|
||||
local title = cc.Label:createWithTTF(ArmatureTestLayer.title(1), s_arialPath, 18)
|
||||
title:setColor(cc.c3b(0,0,0))
|
||||
self:addChild(title, 1, 10000)
|
||||
title:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
|
@ -236,7 +236,7 @@ function TestAsynchronousLoading:onEnter()
|
|||
local subTitle = nil
|
||||
if "" ~= ArmatureTestLayer.subTitle(1) then
|
||||
local subInfo = ArmatureTestLayer.subTitle(1) .. 0.0
|
||||
local subTitle = cc.Label:create(subInfo, s_arialPath, 18)
|
||||
local subTitle = cc.Label:createWithTTF(subInfo, s_arialPath, 18)
|
||||
subTitle:setColor(cc.c3b(0,0,0))
|
||||
self:addChild(subTitle, 1, 10001)
|
||||
subTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
|
@ -1164,7 +1164,7 @@ function TestArmatureNesting2:onEnter()
|
|||
end
|
||||
|
||||
self._touchedMenu = false
|
||||
local label = cc.Label:create("Change Mount", s_arialPath, 20)
|
||||
local label = cc.Label:createWithTTF("Change Mount", s_arialPath, 20)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local menuItem = cc.MenuItemLabel:create(label)
|
||||
menuItem:registerScriptTapHandler(changeMountCallback)
|
||||
|
|
|
@ -63,7 +63,7 @@ function SceneEditorTestLayer.create()
|
|||
end
|
||||
|
||||
function SceneEditorTestLayer:createTitle()
|
||||
local title = cc.Label:create(self.title[sceneEditorTestIdx], s_arialPath, 18)
|
||||
local title = cc.Label:createWithTTF(self.title[sceneEditorTestIdx], s_arialPath, 18)
|
||||
title:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
title:setColor(cc.c3b(255, 255, 255))
|
||||
self:addChild(title, 1, 10000)
|
||||
|
|
|
@ -105,7 +105,7 @@ local function CocosDenshionTest()
|
|||
m_nTestCount = table.getn(testItems)
|
||||
local i = 1
|
||||
for i = 1, m_nTestCount do
|
||||
local label = cc.Label:create(testItems[i], s_arialPath, 24)
|
||||
local label = cc.Label:createWithTTF(testItems[i], s_arialPath, 24)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local pMenuItem = cc.MenuItemLabel:create(label)
|
||||
pMenuItem:registerScriptTapHandler(menuCallback)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
local function CurrentLanguageTest()
|
||||
local ret = cc.Layer:create()
|
||||
local label = cc.Label:create("Current language Test", s_arialPath, 28)
|
||||
local label = cc.Label:createWithTTF("Current language Test", s_arialPath, 28)
|
||||
ret:addChild(label, 0)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y-50) )
|
||||
|
||||
local labelLanguage = cc.Label:create("", s_arialPath, 20)
|
||||
local labelLanguage = cc.Label:createWithTTF("", s_arialPath, 20)
|
||||
labelLanguage:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
labelLanguage:setPosition(VisibleRect:center())
|
||||
|
||||
|
|
|
@ -66,13 +66,13 @@ local function drawPrimitivesMainLayer()
|
|||
|
||||
local function InitTitle(layer)
|
||||
--Title
|
||||
local lableTitle = cc.Label:create(GetTitle(), s_arialPath, 40)
|
||||
local lableTitle = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40)
|
||||
layer:addChild(lableTitle, 15)
|
||||
lableTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
lableTitle:setPosition(cc.p(size.width / 2, size.height - 32))
|
||||
lableTitle:setColor(cc.c3b(255, 255, 40))
|
||||
--SubTitle
|
||||
local subLabelTitle = cc.Label:create(GetSubTitle(), s_thonburiPath, 16)
|
||||
local subLabelTitle = cc.Label:createWithTTF(GetSubTitle(), s_thonburiPath, 16)
|
||||
layer:addChild(subLabelTitle, 15)
|
||||
subLabelTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
subLabelTitle:setPosition(cc.p(size.width / 2, size.height - 80))
|
||||
|
|
|
@ -352,7 +352,7 @@ function CreateEffectsTestLayer()
|
|||
|
||||
local x, y = size.width, size.height
|
||||
|
||||
titleLabel = cc.Label:create(EffectsList[ActionIdx], s_markerFeltFontPath, 32)
|
||||
titleLabel = cc.Label:createWithTTF(EffectsList[ActionIdx], s_markerFeltFontPath, 32)
|
||||
titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
titleLabel:setPosition(x / 2, y - 80)
|
||||
testLayer:addChild(titleLabel)
|
||||
|
|
|
@ -78,8 +78,8 @@ local function runNotificationCenterTest()
|
|||
cc.NotificationCenter:getInstance():postNotification(NotificationCenterParam.MSG_SWITCH_STATE,selectedItem)
|
||||
end
|
||||
|
||||
local switchlabel1 = cc.Label:create("switch off", "Marker Felt", 26)
|
||||
local switchlabel2 = cc.Label:create("switch on", "Marker Felt", 26)
|
||||
local switchlabel1 = cc.Label:createWithSystemFont("switch off", "Marker Felt", 26)
|
||||
local switchlabel2 = cc.Label:createWithSystemFont("switch on", "Marker Felt", 26)
|
||||
local switchitem1 = cc.MenuItemLabel:create(switchlabel1)
|
||||
local switchitem2 = cc.MenuItemLabel:create(switchlabel2)
|
||||
local switchitem = cc.MenuItemToggle:create(switchitem1)
|
||||
|
@ -144,9 +144,9 @@ local function runNotificationCenterTest()
|
|||
lightArray[i]:setPosition(cc.p(100, s.height / 4 * i) )
|
||||
pLayer:addChild(lightArray[i])
|
||||
|
||||
local connectlabel1 = cc.Label:create("not connected", "Marker Felt", 26)
|
||||
local connectlabel1 = cc.Label:createWithSystemFont("not connected", "Marker Felt", 26)
|
||||
|
||||
local connectlabel2 = cc.Label:create("connected", "Marker Felt", 26)
|
||||
local connectlabel2 = cc.Label:createWithSystemFont("connected", "Marker Felt", 26)
|
||||
local connectitem1 = cc.MenuItemLabel:create(connectlabel1)
|
||||
local connectitem2 = cc.MenuItemLabel:create(connectlabel2)
|
||||
local connectitem = cc.MenuItemToggle:create(connectitem1)
|
||||
|
@ -348,7 +348,7 @@ local function runCCControlTest()
|
|||
pLayer:addChild(pRibbon)
|
||||
|
||||
--Add the title
|
||||
pSceneTitleLabel = cc.Label:create("Title", "Arial", 12)
|
||||
pSceneTitleLabel = cc.Label:createWithSystemFont("Title", "Arial", 12)
|
||||
pSceneTitleLabel:setPosition(cc.p (VisibleRect:center().x, VisibleRect:top().y - pSceneTitleLabel:getContentSize().height / 2 - 5))
|
||||
pLayer:addChild(pSceneTitleLabel, 1)
|
||||
pSceneTitleLabel:setString(pStrTitle)
|
||||
|
@ -366,7 +366,7 @@ local function runCCControlTest()
|
|||
|
||||
local screenSize = cc.Director:getInstance():getWinSize()
|
||||
--Add a label in which the slider value will be displayed
|
||||
local pDisplayValueLabel = cc.Label:create("Move the slider thumb!\nThe lower slider is restricted." ,"Marker Felt", 32)
|
||||
local pDisplayValueLabel = cc.Label:createWithSystemFont("Move the slider thumb!\nThe lower slider is restricted." ,"Marker Felt", 32)
|
||||
pDisplayValueLabel:retain()
|
||||
pDisplayValueLabel:setAnchorPoint(cc.p(0.5, -1.0))
|
||||
pDisplayValueLabel:setPosition(cc.p(screenSize.width / 1.7, screenSize.height / 2.0))
|
||||
|
@ -453,7 +453,7 @@ local function runCCControlTest()
|
|||
pNode:addChild(pBackground)
|
||||
dLayer_width = dLayer_width + pBackground:getContentSize().width
|
||||
|
||||
pColorLabel = cc.Label:create("#color", "Marker Felt", 30)
|
||||
pColorLabel = cc.Label:createWithSystemFont("#color", "Marker Felt", 30)
|
||||
pColorLabel:retain()
|
||||
pColorLabel:setPosition(pBackground:getPosition())
|
||||
pNode:addChild(pColorLabel)
|
||||
|
@ -487,7 +487,7 @@ local function runCCControlTest()
|
|||
pNode:addChild(pBackground)
|
||||
dLayer_width = dLayer_width + pBackground:getContentSize().width
|
||||
|
||||
local pDisplayValueLabel = cc.Label:create("#color" ,"Marker Felt" ,30)
|
||||
local pDisplayValueLabel = cc.Label:createWithSystemFont("#color" ,"Marker Felt" ,30)
|
||||
pDisplayValueLabel:retain()
|
||||
|
||||
pDisplayValueLabel:setPosition(pBackground:getPosition())
|
||||
|
@ -511,8 +511,8 @@ local function runCCControlTest()
|
|||
cc.Sprite:create("extensions/switch-on.png"),
|
||||
cc.Sprite:create("extensions/switch-off.png"),
|
||||
cc.Sprite:create("extensions/switch-thumb.png"),
|
||||
cc.Label:create("On", "Arial-BoldMT", 16),
|
||||
cc.Label:create("Off", "Arial-BoldMT", 16)
|
||||
cc.Label:createWithSystemFont("On", "Arial-BoldMT", 16),
|
||||
cc.Label:createWithSystemFont("Off", "Arial-BoldMT", 16)
|
||||
)
|
||||
pSwitchControl:setPosition(cc.p (dLayer_width + 10 + pSwitchControl:getContentSize().width / 2, 0))
|
||||
pNode:addChild(pSwitchControl)
|
||||
|
@ -532,7 +532,7 @@ local function runCCControlTest()
|
|||
local pBackgroundButton = cc.Scale9Sprite:create("extensions/button.png")
|
||||
local pBackgroundHighlightedButton = cc.Scale9Sprite:create("extensions/buttonHighlighted.png")
|
||||
|
||||
pTitleButton = cc.Label:create(pStrTitle, "Marker Felt", 30)
|
||||
pTitleButton = cc.Label:createWithSystemFont(pStrTitle, "Marker Felt", 30)
|
||||
|
||||
pTitleButton:setColor(cc.c3b(159, 168, 176))
|
||||
|
||||
|
@ -587,7 +587,7 @@ local function runCCControlTest()
|
|||
local pBackgroundHighlightedButton = cc.Scale9Sprite:create("extensions/buttonHighlighted.png")
|
||||
pBackgroundHighlightedButton:setPreferredSize(cc.size(45, 45))
|
||||
|
||||
local pTitleButton = cc.Label:create(pStrTitle, "Marker Felt", 30)
|
||||
local pTitleButton = cc.Label:createWithSystemFont(pStrTitle, "Marker Felt", 30)
|
||||
|
||||
pTitleButton:setColor(cc.c3b(159, 168, 176))
|
||||
|
||||
|
@ -651,7 +651,7 @@ local function runCCControlTest()
|
|||
|
||||
--Add a label in which the button events will be displayed
|
||||
local pDisplayValueLabel = nil
|
||||
pDisplayValueLabel = cc.Label:create("No Event", "Marker Felt", 32)
|
||||
pDisplayValueLabel = cc.Label:createWithSystemFont("No Event", "Marker Felt", 32)
|
||||
pDisplayValueLabel:setAnchorPoint(cc.p(0.5, -1))
|
||||
pDisplayValueLabel:setPosition(cc.p(screenSize.width / 2.0, screenSize.height / 2.0))
|
||||
pLayer:addChild(pDisplayValueLabel, 1)
|
||||
|
@ -660,7 +660,7 @@ local function runCCControlTest()
|
|||
local pBackgroundButton = cc.Scale9Sprite:create("extensions/button.png")
|
||||
local pBackgroundHighlightedButton = cc.Scale9Sprite:create("extensions/buttonHighlighted.png")
|
||||
|
||||
local pTitleButtonLabel = cc.Label:create("Touch Me!", "Marker Felt", 30)
|
||||
local pTitleButtonLabel = cc.Label:createWithSystemFont("Touch Me!", "Marker Felt", 30)
|
||||
pTitleButtonLabel:setColor(cc.c3b(159, 168, 176))
|
||||
|
||||
local pControlButton = cc.ControlButton:create(pTitleButtonLabel, pBackgroundButton)
|
||||
|
@ -764,7 +764,7 @@ local function runCCControlTest()
|
|||
|
||||
dLayer_width = dLayer_width + pBackground:getContentSize().width
|
||||
|
||||
local pDisplayValueLabel = cc.Label:create("", "HelveticaNeue-Bold", 30)
|
||||
local pDisplayValueLabel = cc.Label:createWithSystemFont("", "HelveticaNeue-Bold", 30)
|
||||
pDisplayValueLabel:setPosition(pBackground:getPosition())
|
||||
pNode:addChild(pDisplayValueLabel)
|
||||
|
||||
|
@ -816,7 +816,7 @@ local function runCCControlTest()
|
|||
background:setPosition(cc.p(layer_width + background:getContentSize().width / 2.0, 0))
|
||||
pNode:addChild(background)
|
||||
|
||||
local pDisplayValueLabel = cc.Label:create("0", "HelveticaNeue-Bold", 30)
|
||||
local pDisplayValueLabel = cc.Label:createWithSystemFont("0", "HelveticaNeue-Bold", 30)
|
||||
|
||||
pDisplayValueLabel:setPosition(background:getPosition())
|
||||
pNode:addChild(pDisplayValueLabel)
|
||||
|
@ -901,7 +901,7 @@ local function runEditBoxTest()
|
|||
pBg:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2))
|
||||
newLayer:addChild(pBg)
|
||||
|
||||
local TTFShowEditReturn = cc.Label:create("No edit control return!", "", 30)
|
||||
local TTFShowEditReturn = cc.Label:createWithSystemFont("No edit control return!", "", 30)
|
||||
TTFShowEditReturn:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50))
|
||||
newLayer:addChild(TTFShowEditReturn)
|
||||
|
||||
|
@ -1032,7 +1032,7 @@ function TableViewTestLayer.tableCellAtIndex(table, idx)
|
|||
sprite:setPosition(cc.p(0, 0))
|
||||
cell:addChild(sprite)
|
||||
|
||||
label = cc.Label:create(strValue, "Helvetica", 20.0)
|
||||
label = cc.Label:createWithSystemFont(strValue, "Helvetica", 20.0)
|
||||
label:setPosition(cc.p(0,0))
|
||||
label:setAnchorPoint(cc.p(0,0))
|
||||
label:setTag(123)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
local receiveTextTimes = 0
|
||||
local receiveBinaryTimes = 0
|
||||
|
||||
local label = cc.Label:create("WebSocket Test", s_arialPath, 28)
|
||||
local label = cc.Label:createWithTTF("WebSocket Test", s_arialPath, 28)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p( winSize.width / 2, winSize.height - MARGIN))
|
||||
layer:addChild(label, 0)
|
||||
|
@ -37,7 +37,7 @@
|
|||
end
|
||||
end
|
||||
end
|
||||
local labelSendText = cc.Label:create("Send Text", s_arialPath, 22)
|
||||
local labelSendText = cc.Label:createWithTTF("Send Text", s_arialPath, 22)
|
||||
labelSendText:setAnchorPoint(0.5, 0.5)
|
||||
local itemSendText = cc.MenuItemLabel:create(labelSendText)
|
||||
itemSendText:registerScriptTapHandler(onMenuSendTextClicked)
|
||||
|
@ -56,7 +56,7 @@
|
|||
end
|
||||
end
|
||||
end
|
||||
local labelSendBinary = cc.Label:create("Send Binary", s_arialPath, 22)
|
||||
local labelSendBinary = cc.Label:createWithTTF("Send Binary", s_arialPath, 22)
|
||||
labelSendBinary:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local itemSendBinary = cc.MenuItemLabel:create(labelSendBinary)
|
||||
itemSendBinary:registerScriptTapHandler(onMenuSendBinaryClicked)
|
||||
|
@ -64,19 +64,19 @@
|
|||
menuRequest:addChild(itemSendBinary)
|
||||
|
||||
--Send Text Status Label
|
||||
sendTextStatus = cc.Label:create("Send Text WS is waiting...", s_arialPath, 14,cc.size(160, 100),cc.VERTICAL_TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
sendTextStatus = cc.Label:createWithTTF("Send Text WS is waiting...", s_arialPath, 14,cc.size(160, 100),cc.VERTICAL_TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
sendTextStatus:setAnchorPoint(cc.p(0, 0))
|
||||
sendTextStatus:setPosition(cc.p(0, 25))
|
||||
layer:addChild(sendTextStatus)
|
||||
|
||||
--Send Binary Status Label
|
||||
sendBinaryStatus = cc.Label:create("Send Binary WS is waiting...", s_arialPath, 14, cc.size(160, 100), cc.VERTICAL_TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
sendBinaryStatus = cc.Label:createWithTTF("Send Binary WS is waiting...", s_arialPath, 14, cc.size(160, 100), cc.VERTICAL_TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
sendBinaryStatus:setAnchorPoint(cc.p(0, 0))
|
||||
sendBinaryStatus:setPosition(cc.p(160, 25))
|
||||
layer:addChild(sendBinaryStatus)
|
||||
|
||||
--Error Label
|
||||
errorStatus = cc.Label:create("Error WS is waiting...", s_arialPath, 14, cc.size(160, 100), cc.VERTICAL_TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
errorStatus = cc.Label:createWithTTF("Error WS is waiting...", s_arialPath, 14, cc.size(160, 100), cc.VERTICAL_TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
errorStatus:setAnchorPoint(cc.p(0, 0))
|
||||
errorStatus:setPosition(cc.p(320, 25))
|
||||
layer:addChild(errorStatus)
|
||||
|
|
|
@ -37,12 +37,12 @@ local function showFont(ret, pFont)
|
|||
ret:removeChildByTag(kTagLabel3, true)
|
||||
ret:removeChildByTag(kTagLabel4, true)
|
||||
|
||||
local top = cc.Label:create(pFont, pFont, 24)
|
||||
local left = cc.Label:create("alignment left", pFont, fontSize,
|
||||
local top = cc.Label:createWithSystemFont(pFont, pFont, 24)
|
||||
local left = cc.Label:createWithSystemFont("alignment left", pFont, fontSize,
|
||||
blockSize, cc.TEXT_ALIGNMENT_LEFT, verticalAlignment[vAlignIdx])
|
||||
local center = cc.Label:create("alignment center", pFont, fontSize,
|
||||
local center = cc.Label:createWithSystemFont("alignment center", pFont, fontSize,
|
||||
blockSize, cc.TEXT_ALIGNMENT_CENTER, verticalAlignment[vAlignIdx])
|
||||
local right = cc.Label:create("alignment right", pFont, fontSize,
|
||||
local right = cc.Label:createWithSystemFont("alignment right", pFont, fontSize,
|
||||
blockSize, cc.TEXT_ALIGNMENT_RIGHT, verticalAlignment[vAlignIdx])
|
||||
|
||||
local leftColor = cc.LayerColor:create(cc.c4b(100, 100, 100, 255), blockSize.width, blockSize.height)
|
||||
|
|
|
@ -4,12 +4,12 @@ local function KeypadMainLayer()
|
|||
local function onEnter()
|
||||
print("come in")
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local label = cc.Label:create("Keypad Test", s_thonburiPath, 28)
|
||||
local label = cc.Label:createWithTTF("Keypad Test", s_thonburiPath, 28)
|
||||
layer:addChild(label, 0)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p(s.width/2, s.height-50))
|
||||
|
||||
local labelTip = cc.Label:create("Please press any key...", "s_thonburiPath", 22)
|
||||
local labelTip = cc.Label:createWithTTF("Please press any key...", s_thonburiPath, 22)
|
||||
labelTip:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
labelTip:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
layer:addChild(labelTip, 0)
|
||||
|
|
|
@ -1478,7 +1478,7 @@ function LabelFontNameTest.create()
|
|||
label1:setPosition( cc.p(size.width/2, size.height * 0.7) )
|
||||
layer:addChild(label1)
|
||||
|
||||
local label3 = cc.Label:create("fonts/Marker Felt.ttf","fonts/Marker Felt.ttf",32)
|
||||
local label3 = cc.Label:createWithTTF("fonts/Marker Felt.ttf","fonts/Marker Felt.ttf",32)
|
||||
label3:setPosition( cc.p(size.width/2, size.height * 0.5) )
|
||||
layer:addChild(label3)
|
||||
|
||||
|
@ -1673,7 +1673,7 @@ function LabelTTFOldNew.create()
|
|||
local s = cc.Director:getInstance():getWinSize()
|
||||
local delta = s.height/4
|
||||
|
||||
local label1 = cc.Label:create("Cocos2d-x Label Test", "arial", 24)
|
||||
local label1 = cc.Label:createWithSystemFont("Cocos2d-x Label Test", "arial", 24)
|
||||
layer:addChild(label1, 0, kTagBitmapAtlas1)
|
||||
label1:setPosition(cc.p(s.width/2, delta * 2))
|
||||
label1:setColor(cc.c3b(255, 0, 0))
|
||||
|
|
|
@ -442,9 +442,9 @@ local function LayerGradient()
|
|||
local layer1 = cc.LayerGradient:create(cc.c4b(255,0,0,255), cc.c4b(0,255,0,255), cc.p(0.9, 0.9))
|
||||
ret:addChild(layer1, 0, kTagLayer)
|
||||
|
||||
local label1 = cc.Label:create("Compressed Interpolation: Enabled", s_markerFeltFontPath, 26)
|
||||
local label1 = cc.Label:createWithTTF("Compressed Interpolation: Enabled", s_markerFeltFontPath, 26)
|
||||
label1:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local label2 = cc.Label:create("Compressed Interpolation: Disabled", s_markerFeltFontPath, 26)
|
||||
local label2 = cc.Label:createWithTTF("Compressed Interpolation: Disabled", s_markerFeltFontPath, 26)
|
||||
label2:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local item1 = cc.MenuItemLabel:create(label1)
|
||||
local item2 = cc.MenuItemLabel:create(label2)
|
||||
|
|
|
@ -48,13 +48,13 @@ local function LuaBridgeLayer()
|
|||
|
||||
local function newLuaJavaBridge()
|
||||
local newScene = cc.Scene:create()
|
||||
local titleLabel = cc.Label:create("", s_arialPath, 28)
|
||||
local titleLabel = cc.Label:createWithTTF("", s_arialPath, 28)
|
||||
newScene:addChild(titleLabel, 1)
|
||||
titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
titleLabel:setPosition(s.width / 2, s.height - 50)
|
||||
titleLabel:setString("LuaJavaBridge Test")
|
||||
|
||||
subtitleLabel = cc.Label:create("", s_thonburiPath, 16)
|
||||
subtitleLabel = cc.Label:createWithTTF("", s_thonburiPath, 16)
|
||||
newScene:addChild(subtitleLabel, 1)
|
||||
subtitleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
subtitleLabel:setPosition(s.width / 2, s.height - 80)
|
||||
|
@ -88,13 +88,13 @@ local function LuaBridgeLayer()
|
|||
|
||||
local function newLuaObjectCBridge()
|
||||
local newScene = cc.Scene:create()
|
||||
local titleLabel = cc.Label:create("", s_arialPath, 28)
|
||||
local titleLabel = cc.Label:createWithTTF("", s_arialPath, 28)
|
||||
newScene:addChild(titleLabel, 1)
|
||||
titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
titleLabel:setPosition(s.width / 2, s.height - 50)
|
||||
titleLabel:setString("LuaObjectCBridge Test")
|
||||
|
||||
subtitleLabel = cc.Label:create("", s_thonburiPath, 16)
|
||||
subtitleLabel = cc.Label:createWithTTF("", s_thonburiPath, 16)
|
||||
newScene:addChild(subtitleLabel, 1)
|
||||
subtitleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
subtitleLabel:setPosition(s.width / 2, s.height - 80)
|
||||
|
|
|
@ -520,7 +520,7 @@ local function RemoveMenuItemWhenMove()
|
|||
local ret = cc.Layer:create()
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local label = cc.Label:create("click item and move, should not crash", s_arialPath, 20)
|
||||
local label = cc.Label:createWithTTF("click item and move, should not crash", s_arialPath, 20)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p(s.width/2, s.height - 30))
|
||||
ret:addChild(label)
|
||||
|
|
|
@ -165,14 +165,14 @@ function EventDispatcherTestDemo:createMenu()
|
|||
end
|
||||
|
||||
function EventDispatcherTestDemo:creatTitleAndSubTitle(idx)
|
||||
local title = cc.Label:create(EventDispatcherTestDemo.title(idx),s_arialPath,18)
|
||||
local title = cc.Label:createWithTTF(EventDispatcherTestDemo.title(idx),s_arialPath,18)
|
||||
title:setColor(cc.c3b(128,128,0))
|
||||
self:addChild(title, 1, 10000)
|
||||
title:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30))
|
||||
local subTitle = nil
|
||||
if "" ~= EventDispatcherTestDemo.subTitle(idx) then
|
||||
local subTitle = cc.Label:create(EventDispatcherTestDemo.subTitle(idx), s_arialPath, 18)
|
||||
local subTitle = cc.Label:createWithTTF(EventDispatcherTestDemo.subTitle(idx), s_arialPath, 18)
|
||||
subTitle:setColor(cc.c3b(128,128,0))
|
||||
self:addChild(subTitle, 1, 10001)
|
||||
subTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
|
@ -493,7 +493,7 @@ function RemoveListenerWhenDispatchingTest:onEnter()
|
|||
local eventDispatcher = self:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener1, sprite1)
|
||||
|
||||
local statusLabel = cc.Label:create("The sprite could be touched!", "", 20)
|
||||
local statusLabel = cc.Label:createWithSystemFont("The sprite could be touched!", "", 20)
|
||||
statusLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
statusLabel:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height - 90))
|
||||
self:addChild(statusLabel)
|
||||
|
@ -560,7 +560,7 @@ function CustomEventTest:onEnter()
|
|||
|
||||
cc.MenuItemFont:setFontSize(20)
|
||||
|
||||
local statusLabel1 = cc.Label:create("No custom event 1 received!", "", 20)
|
||||
local statusLabel1 = cc.Label:createWithSystemFont("No custom event 1 received!", "", 20)
|
||||
statusLabel1:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
statusLabel1:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height-90 ))
|
||||
self:addChild(statusLabel1)
|
||||
|
@ -586,7 +586,7 @@ function CustomEventTest:onEnter()
|
|||
sendItem1:registerScriptTapHandler(sendCallback1)
|
||||
sendItem1:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height/2))
|
||||
|
||||
local statusLabel2 = cc.Label:create("No custom event 2 received!", "", 20)
|
||||
local statusLabel2 = cc.Label:createWithSystemFont("No custom event 2 received!", "", 20)
|
||||
statusLabel2:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
statusLabel2:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height-120 ))
|
||||
self:addChild(statusLabel2)
|
||||
|
@ -659,7 +659,7 @@ function LabelKeyboardEventTest:onEnter()
|
|||
local origin = cc.Director:getInstance():getVisibleOrigin()
|
||||
local size = cc.Director:getInstance():getVisibleSize()
|
||||
|
||||
local statusLabel = cc.Label:create("No keyboard event received!", "", 20)
|
||||
local statusLabel = cc.Label:createWithSystemFont("No keyboard event received!", "", 20)
|
||||
statusLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
statusLabel:setPosition(cc.p(origin.x + size.width/2,origin.y + size.height/2))
|
||||
self:addChild(statusLabel)
|
||||
|
@ -1365,7 +1365,7 @@ function Issue4129Test:onEnter()
|
|||
local eventDispatcher = self:getEventDispatcher()
|
||||
|
||||
local function eventCustomListener(event)
|
||||
local label = cc.Label:create("Yeah, this issue was fixed.", "", 20)
|
||||
local label = cc.Label:createWithSystemFont("Yeah, this issue was fixed.", "", 20)
|
||||
label:setAnchorPoint(cc.p(0, 0.5))
|
||||
label:setPosition(VisibleRect:left())
|
||||
self:addChild(label)
|
||||
|
|
|
@ -125,13 +125,13 @@ local function OpenGLTestMainLayer()
|
|||
|
||||
local function InitTitle(layer)
|
||||
--Title
|
||||
local lableTitle = cc.Label:create(GetTitle(), s_arialPath, 40)
|
||||
local lableTitle = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40)
|
||||
layer:addChild(lableTitle, 15)
|
||||
lableTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
lableTitle:setPosition(cc.p(size.width/2, size.height-32))
|
||||
lableTitle:setColor(cc.c3b(255,255,40))
|
||||
--SubTitle
|
||||
local subLabelTitle = cc.Label:create(GetSubTitle(), s_thonburiPath, 16)
|
||||
local subLabelTitle = cc.Label:createWithTTF(GetSubTitle(), s_thonburiPath, 16)
|
||||
layer:addChild(subLabelTitle, 15)
|
||||
subLabelTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
subLabelTitle:setPosition(cc.p(size.width/2, size.height-80))
|
||||
|
|
|
@ -98,12 +98,12 @@ local function getBaseLayer()
|
|||
|
||||
emitter = nil
|
||||
|
||||
titleLabel = cc.Label:create("", s_arialPath, 28)
|
||||
titleLabel = cc.Label:createWithTTF("", s_arialPath, 28)
|
||||
layer:addChild(titleLabel, 100, 1000)
|
||||
titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
titleLabel:setPosition(s.width / 2, s.height - 50)
|
||||
|
||||
subtitleLabel = cc.Label:create("", s_arialPath, 16)
|
||||
subtitleLabel = cc.Label:createWithTTF("", s_arialPath, 16)
|
||||
layer:addChild(subtitleLabel, 100)
|
||||
subtitleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
subtitleLabel:setPosition(s.width / 2, s.height - 80)
|
||||
|
|
|
@ -357,7 +357,7 @@ local function initWithMainTest(scene, asubtest, nNodes)
|
|||
menu:setPosition(s.width / 2, s.height - 65)
|
||||
scene:addChild(menu, 1)
|
||||
|
||||
infoLabel = cc.Label:create("0 nodes", s_markerFeltFontPath, 30)
|
||||
infoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30)
|
||||
infoLabel:setColor(cc.c3b(0, 200, 20))
|
||||
infoLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
infoLabel:setPosition(s.width / 2, s.height - 90)
|
||||
|
@ -389,7 +389,7 @@ local function initWithMainTest(scene, asubtest, nNodes)
|
|||
scene:addChild(subMenu, 1)
|
||||
|
||||
-- add title label
|
||||
titleLabel = cc.Label:create("No title", s_arialPath, 40)
|
||||
titleLabel = cc.Label:createWithTTF("No title", s_arialPath, 40)
|
||||
scene:addChild(titleLabel, 1)
|
||||
titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
titleLabel:setPosition(s.width / 2, s.height - 32)
|
||||
|
|
|
@ -338,14 +338,14 @@ local function runNodeChildrenTest()
|
|||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
--Title
|
||||
local pLabel = cc.Label:create(GetTitle(), s_arialPath, 40)
|
||||
local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40)
|
||||
pNewscene:addChild(pLabel, 1)
|
||||
pLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pLabel:setPosition(cc.p(s.width/2, s.height-32))
|
||||
pLabel:setColor(cc.c3b(255,255,40))
|
||||
|
||||
if (nil ~= GetSubTitle()) and ("" ~= GetSubTitle()) then
|
||||
local pSubLabel = cc.Label:create(GetSubTitle(), s_thonburiPath, 16)
|
||||
local pSubLabel = cc.Label:createWithTTF(GetSubTitle(), s_thonburiPath, 16)
|
||||
pNewscene:addChild(pSubLabel, 1)
|
||||
pSubLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pSubLabel:setPosition(cc.p(s.width/2, s.height-80))
|
||||
|
@ -372,7 +372,7 @@ local function runNodeChildrenTest()
|
|||
pNewscene:addChild(pMenuAddOrSub,1)
|
||||
|
||||
--InfoLayer
|
||||
local pInfoLabel = cc.Label:create("0 nodes", s_markerFeltFontPath, 30)
|
||||
local pInfoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30)
|
||||
pInfoLabel:setColor(cc.c3b(0,200,20))
|
||||
pInfoLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pInfoLabel:setPosition(cc.p(s.width/2, s.height/2-15))
|
||||
|
@ -828,7 +828,7 @@ local function runParticleTest()
|
|||
pMenuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15))
|
||||
pNewScene:addChild(pMenuAddOrSub,1)
|
||||
|
||||
local pInfoLabel = cc.Label:create("0 nodes", s_markerFeltFontPath, 30)
|
||||
local pInfoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30)
|
||||
pInfoLabel:setColor(cc.c3b(0,200,20))
|
||||
pInfoLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pInfoLabel:setPosition(cc.p(s.width/2, s.height - 90))
|
||||
|
@ -867,7 +867,7 @@ local function runParticleTest()
|
|||
pSubMenu:setPosition(cc.p(s.width/2, 80))
|
||||
pNewScene:addChild(pSubMenu, 2)
|
||||
|
||||
local pLabel = cc.Label:create(GetTitle(), s_arialPath, 40)
|
||||
local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40)
|
||||
pNewScene:addChild(pLabel, 1)
|
||||
pLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pLabel:setPosition(cc.p(s.width/2, s.height-32))
|
||||
|
@ -1274,7 +1274,7 @@ local function runSpriteTest()
|
|||
pMenuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15))
|
||||
pNewScene:addChild(pMenuAddOrSub,1)
|
||||
|
||||
local pInfoLabel = cc.Label:create("0 nodes", s_markerFeltFontPath, 30)
|
||||
local pInfoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30)
|
||||
pInfoLabel:setColor(cc.c3b(0,200,20))
|
||||
pInfoLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pInfoLabel:setPosition(cc.p(s.width/2, s.height - 90))
|
||||
|
@ -1313,7 +1313,7 @@ local function runSpriteTest()
|
|||
pSubMenu:setPosition(cc.p(s.width/2, 80))
|
||||
pNewScene:addChild(pSubMenu, 2)
|
||||
|
||||
local pLabel = cc.Label:create(GetTitle(), s_arialPath, 40)
|
||||
local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40)
|
||||
pNewScene:addChild(pLabel, 1)
|
||||
pLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pLabel:setPosition(cc.p(s.width/2, s.height-32))
|
||||
|
@ -1438,14 +1438,14 @@ local function runTextureTest()
|
|||
end
|
||||
|
||||
--Title
|
||||
local pLabel = cc.Label:create(GetTitle(), s_arialPath, 40)
|
||||
local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40)
|
||||
pLayer:addChild(pLabel, 1)
|
||||
pLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pLabel:setPosition(cc.p(s.width/2, s.height-32))
|
||||
pLabel:setColor(cc.c3b(255,255,40))
|
||||
|
||||
--Subtitle
|
||||
local pSubLabel = cc.Label:create(GetSubtitle(), s_thonburiPath, 16)
|
||||
local pSubLabel = cc.Label:createWithTTF(GetSubtitle(), s_thonburiPath, 16)
|
||||
pLayer:addChild(pSubLabel, 1)
|
||||
pSubLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pSubLabel:setPosition(cc.p(s.width/2, s.height-80))
|
||||
|
@ -1605,7 +1605,7 @@ local function runTouchesTest()
|
|||
pLayer:addChild(pTouchesTestMenu)
|
||||
|
||||
--Title
|
||||
local pLabel = cc.Label:create(GetTitle(), s_arialPath, 40)
|
||||
local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40)
|
||||
pLayer:addChild(pLabel, 1)
|
||||
pLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
pLabel:setPosition(cc.p(s.width/2, s.height-32))
|
||||
|
@ -1697,13 +1697,13 @@ local function runFuncRelateWithTable()
|
|||
end
|
||||
|
||||
--Title
|
||||
local title = cc.Label:create(GetTitle(), s_arialPath, 28)
|
||||
local title = cc.Label:createWithTTF(GetTitle(), s_arialPath, 28)
|
||||
layer:addChild(title, 1)
|
||||
title:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
title:setPosition(cc.p(s.width/2, s.height-32))
|
||||
title:setColor(cc.c3b(255,255,40))
|
||||
--Subtitle
|
||||
local subTitle = cc.Label:create(GetSubtitle(), s_thonburiPath, 16)
|
||||
local subTitle = cc.Label:createWithTTF(GetSubtitle(), s_thonburiPath, 16)
|
||||
layer:addChild(subTitle, 1)
|
||||
subTitle:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
subTitle:setPosition(cc.p(s.width/2, s.height-80))
|
||||
|
@ -1742,7 +1742,7 @@ local function runFuncRelateWithTable()
|
|||
layer:addChild(menuAddOrSub,1)
|
||||
|
||||
--num
|
||||
local numLabel = cc.Label:create("10000", s_markerFeltFontPath, 30)
|
||||
local numLabel = cc.Label:createWithTTF("10000", s_markerFeltFontPath, 30)
|
||||
numLabel:setColor(cc.c3b(0,200,20))
|
||||
numLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
numLabel:setPosition(cc.p(s.width/2, s.height/2-15))
|
||||
|
|
|
@ -1076,22 +1076,22 @@ local function PhysicsContactTest()
|
|||
|
||||
local s = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height);
|
||||
|
||||
local label = cc.Label:create(tostring(layer.yellowBoxNum), s_arialPath, 32);
|
||||
local label = cc.Label:createWithTTF(tostring(layer.yellowBoxNum), s_arialPath, 32);
|
||||
root:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2, s.height-50));
|
||||
|
||||
label = cc.Label:create(tostring(layer.blueBoxNum), s_arialPath, 32);
|
||||
label = cc.Label:createWithTTF(tostring(layer.blueBoxNum), s_arialPath, 32);
|
||||
root:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2, s.height-90));
|
||||
|
||||
label = cc.Label:create(tostring(layer.yellowTriangleNum), s_arialPath, 32);
|
||||
label = cc.Label:createWithTTF(tostring(layer.yellowTriangleNum), s_arialPath, 32);
|
||||
root:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2, s.height-130));
|
||||
|
||||
label = cc.Label:create(tostring(layer.blueTriangleNum), s_arialPath, 32);
|
||||
label = cc.Label:createWithTTF(tostring(layer.blueTriangleNum), s_arialPath, 32);
|
||||
root:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2, s.height-170));
|
||||
|
@ -1213,7 +1213,7 @@ local function PhysicsContactTest()
|
|||
menu1:setPosition(cc.p(s.width/2, s.height-50));
|
||||
layer:addChild(menu1, 1);
|
||||
|
||||
local label = cc.Label:create("yellow box", s_arialPath, 32);
|
||||
local label = cc.Label:createWithTTF("yellow box", s_arialPath, 32);
|
||||
layer:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2 - 150, s.height-50));
|
||||
|
@ -1232,7 +1232,7 @@ local function PhysicsContactTest()
|
|||
menu2:setPosition(cc.p(s.width/2, s.height-90));
|
||||
layer:addChild(menu2, 1);
|
||||
|
||||
label = cc.Label:create("blue box", s_arialPath, 32);
|
||||
label = cc.Label:createWithTTF("blue box", s_arialPath, 32);
|
||||
layer:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2 - 150, s.height-90));
|
||||
|
@ -1251,7 +1251,7 @@ local function PhysicsContactTest()
|
|||
menu3:setPosition(cc.p(s.width/2, s.height-130));
|
||||
layer:addChild(menu3, 1);
|
||||
|
||||
label = cc.Label:create("yellow triangle", s_arialPath, 32);
|
||||
label = cc.Label:createWithTTF("yellow triangle", s_arialPath, 32);
|
||||
layer:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2 - 150, s.height-130));
|
||||
|
@ -1270,7 +1270,7 @@ local function PhysicsContactTest()
|
|||
menu4:setPosition(cc.p(s.width/2, s.height-170));
|
||||
layer:addChild(menu4, 1);
|
||||
|
||||
label = cc.Label:create("blue triangle", s_arialPath, 32);
|
||||
label = cc.Label:createWithTTF("blue triangle", s_arialPath, 32);
|
||||
layer:addChild(label, 1);
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5));
|
||||
label:setPosition(cc.p(s.width/2 - 150, s.height-170));
|
||||
|
|
|
@ -54,7 +54,7 @@ local function CreateTestLayer()
|
|||
x = size.width
|
||||
y = size.height
|
||||
|
||||
local label = cc.Label:create("cocos2d", s_tahomaPath, 64)
|
||||
local label = cc.Label:createWithTTF("cocos2d", s_tahomaPath, 64)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(x / 2, y / 2)
|
||||
layer:addChild(label)
|
||||
|
|
|
@ -959,7 +959,7 @@ local function TextureAsync()
|
|||
|
||||
local size =cc.Director:getInstance():getWinSize()
|
||||
|
||||
local label = cc.Label:create("Loading...", s_markerFeltFontPath, 32)
|
||||
local label = cc.Label:createWithTTF("Loading...", s_markerFeltFontPath, 32)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p( size.width/2, size.height/2))
|
||||
ret:addChild(label, 10)
|
||||
|
|
|
@ -62,13 +62,13 @@ local function createLayer1()
|
|||
bg1:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
layer:addChild(bg1, -1)
|
||||
|
||||
local titleLabel = cc.Label:create(Transition_Name[SceneIdx], s_thonburiPath, 32)
|
||||
local titleLabel = cc.Label:createWithTTF(Transition_Name[SceneIdx], s_thonburiPath, 32)
|
||||
layer:addChild(titleLabel)
|
||||
titleLabel:setColor(cc.c3b(255,32,32))
|
||||
titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
titleLabel:setPosition(x / 2, y - 100)
|
||||
|
||||
local label = cc.Label:create("SCENE 1", s_markerFeltFontPath, 38)
|
||||
local label = cc.Label:createWithTTF("SCENE 1", s_markerFeltFontPath, 38)
|
||||
label:setColor(cc.c3b(16,16,255))
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(x / 2, y / 2)
|
||||
|
@ -107,13 +107,13 @@ local function createLayer2()
|
|||
bg1:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
layer:addChild(bg1, -1)
|
||||
|
||||
local titleLabel = cc.Label:create(Transition_Name[SceneIdx], s_thonburiPath, 32 )
|
||||
local titleLabel = cc.Label:createWithTTF(Transition_Name[SceneIdx], s_thonburiPath, 32 )
|
||||
layer:addChild(titleLabel)
|
||||
titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
titleLabel:setColor(cc.c3b(255,32,32))
|
||||
titleLabel:setPosition(x / 2, y - 100)
|
||||
|
||||
local label = cc.Label:create("SCENE 2", s_markerFeltFontPath, 38)
|
||||
local label = cc.Label:createWithTTF("SCENE 2", s_markerFeltFontPath, 38)
|
||||
label:setColor(cc.c3b(16,16,255))
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(x / 2, y / 2)
|
||||
|
|
|
@ -72,7 +72,7 @@ end
|
|||
function UserDefaultTestMain()
|
||||
local ret = cc.Scene:create()
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local label = cc.Label:create("UserDefault test see log", s_arialPath, 28)
|
||||
local label = cc.Label:createWithTTF("UserDefault test see log", s_arialPath, 28)
|
||||
ret:addChild(label, 0)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition( cc.p(s.width/2, s.height-50) )
|
||||
|
|
|
@ -7,13 +7,13 @@ local function XMLHttpRequestLayer()
|
|||
local space = 35
|
||||
|
||||
local function init()
|
||||
local label = cc.Label:create("XML Http Request Test", s_arialPath, 28)
|
||||
local label = cc.Label:createWithTTF("XML Http Request Test", s_arialPath, 28)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
label:setPosition(cc.p(winSize.width / 2, winSize.height - margin))
|
||||
layer:addChild(label, 0)
|
||||
|
||||
--Response Code Label
|
||||
local labelStatusCode = cc.Label:create("HTTP Status Code", s_markerFeltFontPath, 20)
|
||||
local labelStatusCode = cc.Label:createWithTTF("HTTP Status Code", s_markerFeltFontPath, 20)
|
||||
labelStatusCode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
labelStatusCode:setPosition(cc.p(winSize.width / 2, winSize.height - margin - 6 * space))
|
||||
layer:addChild(labelStatusCode)
|
||||
|
@ -40,7 +40,7 @@ local function XMLHttpRequestLayer()
|
|||
labelStatusCode:setString("waiting...")
|
||||
end
|
||||
|
||||
local labelGet = cc.Label:create("Test Get", s_arialPath, 22)
|
||||
local labelGet = cc.Label:createWithTTF("Test Get", s_arialPath, 22)
|
||||
labelGet:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local itemGet = cc.MenuItemLabel:create(labelGet)
|
||||
itemGet:registerScriptTapHandler(onMenuGetClicked)
|
||||
|
@ -62,7 +62,7 @@ local function XMLHttpRequestLayer()
|
|||
labelStatusCode:setString("waiting...")
|
||||
end
|
||||
|
||||
local labelPost = cc.Label:create("Test Post", s_arialPath, 22)
|
||||
local labelPost = cc.Label:createWithTTF("Test Post", s_arialPath, 22)
|
||||
labelPost:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local itemPost = cc.MenuItemLabel:create(labelPost)
|
||||
itemPost:registerScriptTapHandler(onMenuPostClicked)
|
||||
|
@ -97,7 +97,7 @@ local function XMLHttpRequestLayer()
|
|||
labelStatusCode:setString("waiting...")
|
||||
end
|
||||
|
||||
local labelPostBinary = cc.Label:create("Test Post Binary", s_arialPath, 22)
|
||||
local labelPostBinary = cc.Label:createWithTTF("Test Post Binary", s_arialPath, 22)
|
||||
labelPostBinary:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local itemPostBinary = cc.MenuItemLabel:create(labelPostBinary)
|
||||
itemPostBinary:registerScriptTapHandler(onMenuPostBinaryClicked)
|
||||
|
@ -126,7 +126,7 @@ local function XMLHttpRequestLayer()
|
|||
labelStatusCode:setString("waiting...")
|
||||
end
|
||||
|
||||
local labelPostJson = cc.Label:create("Test Post Json", s_arialPath, 22)
|
||||
local labelPostJson = cc.Label:createWithTTF("Test Post Json", s_arialPath, 22)
|
||||
labelPostJson:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local itemPostJson = cc.MenuItemLabel:create(labelPostJson)
|
||||
itemPostJson:registerScriptTapHandler(onMenuPostJsonClicked)
|
||||
|
|
|
@ -40,7 +40,7 @@ end
|
|||
|
||||
-- add the menu item for back to main menu
|
||||
function CreateBackMenuItem()
|
||||
local label = cc.Label:create("MainMenu", s_arialPath, 20)
|
||||
local label = cc.Label:createWithTTF("MainMenu", s_arialPath, 20)
|
||||
label:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local MenuItem = cc.MenuItemLabel:create(label)
|
||||
MenuItem:registerScriptTapHandler(MainMenuCallback)
|
||||
|
@ -101,12 +101,12 @@ function Helper.initWithLayer(layer)
|
|||
Helper.currentLayer = layer
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
Helper.titleLabel = cc.Label:create("", s_arialPath, 28)
|
||||
Helper.titleLabel = cc.Label:createWithTTF("", s_arialPath, 28)
|
||||
Helper.titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
layer:addChild(Helper.titleLabel, 1)
|
||||
Helper.titleLabel:setPosition(size.width / 2, size.height - 50)
|
||||
|
||||
Helper.subtitleLabel = cc.Label:create("", s_thonburiPath, 16)
|
||||
Helper.subtitleLabel = cc.Label:createWithTTF("", s_thonburiPath, 16)
|
||||
Helper.subtitleLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
layer:addChild(Helper.subtitleLabel, 1)
|
||||
Helper.subtitleLabel:setPosition(size.width / 2, size.height - 80)
|
||||
|
|
|
@ -159,7 +159,7 @@ function CreateTestMenu()
|
|||
local index = 0
|
||||
local obj = nil
|
||||
for index, obj in pairs(_allTests) do
|
||||
local testLabel = cc.Label:create(obj.name, s_arialPath, 24)
|
||||
local testLabel = cc.Label:createWithTTF(obj.name, s_arialPath, 24)
|
||||
testLabel:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
local testMenuItem = cc.MenuItemLabel:create(testLabel)
|
||||
if not obj.isSupported then
|
||||
|
|
Loading…
Reference in New Issue