By adding the following snippet to your lime-enabled code after lime.loadMap() and before lime.createVisual():
[lua]local onUILabelType = function(object)
local colors
if object.textColor then
colors = split(object.textColor,",")
for i,v in ipairs(colors)do colors[i] = tonumber(colors[i]) end
end
local nl = ui.newLabel{
textColor = colors,
bounds = {object.x,object.y,object.width,object.height},
text = object.text or object.name,
align = object.align,
size = object.size and tonumber(object.size),
font = object.font,
offset = object.offset and tonumber(object.offset)
}
object.objectLayer.group:insert(nl)
end
map:addObjectListener(“UILabel”, onUILabelType)[/lua]
You can now add new labels by creating objects in Tiled with a type of “UILabel”.
The object’s x,y,width,height are automatically used for the label’s bound.
The object’s properties font,size,align,text,textColor are used for the label definition.
By default the object name is used for the label text, if no “text” property is defined.
The label display-object is inserted into the object.objectLayer.group (which I think is the correct place (?))
Another little step towards a GUI-designed Corona app…
Enjoy, Frank.
[import]uid: 8093 topic_id: 6695 reply_id: 306695[/import]