Feature Request - Image Tiling

General discussion about the R.U.B.E editor
Post Reply
BigWinston
Posts: 4
Joined: Thu Oct 10, 2013 1:38 am

Feature Request - Image Tiling

Post by BigWinston »

Hi,

I really like that in addition to using RUBE for Box2D scene editing, I can also add images. I can add images in raw format and scale, rotate, blend, etc. for my needs.

One feature that would be really useful is the ability to tile an image over a given region (polygon would be best, but rectangle would do). This would also allow me to use RUBE to construct complex and eye-catching backgrounds for games.

Would you be able to add this into an upcoming release please?

Thanks!

BW.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Feature Request - Image Tiling

Post by iforce2d »

Good idea. Although I think it should be possible with script. I added an example script in the other sub-forum, here: viewtopic.php?f=9&t=268

However I don't think this is really what you're wanting, right? I guess you mean to completely fill a polygon with a repeating texture, so that the position of each individual image is not really important - more like just marking the polygon as being filled and setting a scale and angle for the texture... is that what you're meaning?

Keep in mind that RUBE only exports a text file description of the scene. Defining the above situation in JSON could be done by simply adding a 'fixtureId' property to the image to say which fixture it should be filling, but would that help you much? The actual implementation of how the above situation would be rendered after loading into your game depends entirely on what platform and API you are using, and it is usually not a trivial process. In contrast, loading an image as a sprite and displaying it at a given location, angle etc is very common and easily done in most rendering APIs.

RUBE uses OpenGL for rendering, so it would be possible for me to use automatic texture generation to display this type of repeated textures in the editor and player views. I had considered that at one time, but I don't really want to deal with the flood of questions from people asking why it does not display the same in their game after they load the JSON file...
BigWinston
Posts: 4
Joined: Thu Oct 10, 2013 1:38 am

Re: Feature Request - Image Tiling

Post by BigWinston »

I guess you mean to completely fill a polygon with a repeating texture, so that the position of each individual image is not really important - more like just marking the polygon as being filled and setting a scale and angle for the texture... is that what you're meaning?
This is really what I mean. I would like to use it for constructing layered backgrounds mostly though, so it wouldn't even necessarily have to be tied to a body - just a straight up rectangular image.

The easiest implementation for you, I would imagine, would be to just create an image as can be done right now, and then set one of its properties to tiled. The Scale property would then be used to adjust the tile scale. This was my original intent when creating the post - the polygon was an after thought.

Being able to do the same thing with polygon bodies would be nice, but a luxury I can do without for now. I already have the code to be able to do this in my application, so I could always tag it and do it with a custom property if its too difficult to create a generic implementation.

Aside from the background creation benefits, it will likely make RUBE a more useful GUI editor too - which I've read your post on BTW.

Thanks.
Post Reply