Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Repeating background image — Gideros Forum

Repeating background image

ar2rsawseenar2rsawseen Maintainer
edited May 2012 in General questions
I was trying to setup a pattern for one of objects and best way I found to do it is to use shape and fill it with texture.

This simple snippet:
local texture = Texture.new("images/crate.png", true, {wrap = Texture.REPEAT})
local shape = Shape.new()
shape:setFillStyle(Shape.TEXTURE, texture)    
shape:beginPath(Shape.NON_ZERO)
shape:moveTo(0,0)
shape:lineTo(application:getDeviceWidth(), 0)
shape:lineTo(application:getDeviceWidth(), application:getDeviceHeight())
shape:lineTo(0, application:getDeviceHeight())
shape:lineTo(0,0)
shape:endPath()
stage:addChild(shape)
produces this result:
image

Image is repeating, but there are some spaces between it. Is this an expected result? Can I remove them?

While I'm at it, I've noticed in Shape example, that there is a winding Shape.NON_ZERO, which I didn't find in documentation. What does it do and are other options?

Hopefully I'm not bombing QnA with too many questions :)
«1

Comments

Sign In or Register to comment.