It looks like you're new here. If you want to get involved, click one of these buttons!
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) |
Comments
The only way to remove the spaces is using textures with size 2^n.
For winding, there isn't any other option besides NON_ZERO and EVEN_ODD (and default is EVEN_ODD). Let me update the documentation.
Thanks
Last question, do you even sleep? No matter when (morning, evening, night) I post the question here, it get's answered before I can go and make a cup of tea.
Great Support guys.
Likes: chipster123
See: http://giderosmobile.com/forum/discussion/comment/975#Comment_975
Maybe we can include this in the FAQ as it's asked twice \m/
If you mean tiling the screen with putting multiple quads taken from a texture pack, than it works. On the other hand (with limitations) ar2rsawseen's solution is the fastest because it only draws a single quad with a repeating texture on it.
But after your post, It seems using a tilemap to draw a repeating pattern can be another fast solution.
Unfortunately texture packs are also expanded to power of two.
is there anything to do a repeating background image currently?
thanks
@atilim what do you have to say in your defense?
Likes: gorkem
I had to change the texture wrapping mode from repeat to clamp because I've observed some tiny rendering issues with repeating textures. To do a repeating background, the current option is using the tile maps. On the other hand, now I'm extending the Texture class so that you can use repeating textures like:
Sorry for the confusion ;;)
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
So if you can put this on the important list, that will be so wonderful.
Likes: atilim, chipster123, avo
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Likes: ndoss
After that I switched to a solid color and it looked ok so I wasn't too concerned but it seems other people were doing the same thing Hopefully it's not too much trouble to add.
Likes: atilim
How I can create infinite sprite? If I'll use size like 50000x50000, is Gideros deals with it and the phone or should I find another way?
I am not sure if the repeating background for your app/game is the same as tiling a background. Because your background might change at certain areas, for which you will have to use something like Tile Based backgrounds that you need to apply and change on the fly. Whereas this option is more so used for filling an area that needs that repeating pattern.
If this suits/fits your game, that will be wonderful and then you will not really need a 50,000 x 50,000 sized sprite/background, you can manage that with a sprite that has the tile sized extra padding on all sides, all you will do is just position the background accordingly, when it reached the edge of the extra padding, you just place it back by that padding and it will scroll and repeat.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
The other way you can do it - is by creating a tile map that again is taller than the screen with enough overlap so that you can jump back to the start of the map and continue to scroll ad infinitum
Hope that helps
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Just wanted to remind of this very important option.
Likes: ar2rsawseen, chipster123, avo