Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Organizing sprites with Gideros built-in layout system — Gideros Forum

Organizing sprites with Gideros built-in layout system

hgy29hgy29 Maintainer
Here is a quick demo to show how it can help (needs Gideros 2020.7).
local grid=Pixel.new(0x0000FF,1,320,480) stage:addChild(grid)
grid:setLayoutParameters{ 
	equalizeCells=false, cellSpacingX=10,cellSpacingY=10,
	insets=30
}
 
local function makeCell(x,y,w,h,c)
	local cell=Pixel.new(c or 0x404040,1)
	grid:addChild(cell)
	cell:setLayoutConstraints{ 
		fill=1, weightx=1, weighty=1,
		gridx=x, gridy=y, gridwidth=w,gridheight=h,
	}
	cell:setLayoutParameters{ insets=5 }
	local text=TextField.new(nil,("Cell %dx%d"):format(x,y),{ flags=FontBase.TLF_REF_LINETOP|FontBase.TLF_CENTER|FontBase.TLF_VCENTER,w=1000 })
	cell:addChild(text)
	text:setLayoutConstraints{ fill=1 }
	text:setTextColor(0xFFFF00)
end
 
makeCell(0,0,1,1)
makeCell(1,0,1,1)
makeCell(2,0,1,2)
makeCell(0,1,2,1)
makeCell(0,2,3,1)
makeCell(0,3,1,1)
makeCell(1,3,2,1)
Result:

+1 -1 (+3 / -0 )Share on Facebook

Comments

Sign In or Register to comment.