Not logged inGosu Forums
Forum back to Help Search Register Login
Up Forum
Topic recording within a recording By Traddles Date 2012-11-26 06:16
Just spent a while debugging something before I was finally able to figure out the issue.

Apparently the image that is generated by Window#record is not a "true" gosu image?

img1 ="some_file.gif")
img2 = window.record(100, 100) { img1.draw(0, 0, 0) }
window.record(100, 100) do
  img1.draw(0,0,0)  #=> is fine and works like a charm
  img2.draw(0,0,0)  #=> generates an exception: "Custom code cannot be recorded into a macro (RuntimeError)"

Is there a reason for this or is this a bug?
Topic black borders when pre-stitching a map By Traddles Date 2012-11-22 00:20
Heh, beat me to it.  Thanks for the tip with splice().  But yeah, I think I prefer the window record method anyway.

Topic black borders when pre-stitching a map By Traddles Date 2012-11-22 00:19
Ahhh, I figured out a way around this.

Didn't know about Window#record.  If I use that to build up a final "result" image instead of Texplay's splice(), no lines.

Also, it occurs to me that I didn't give any screenshots so:

Original implementation (draw the 32x32 tile images individually every frame.  problems with framerate)

Using Texplay's splice() method to join all the individual 16x16 pixel images into one big "result" image (fixed framerate problem but resulted in black lines around tiles that have transparency)

Finally, using Window#record() instead of splice() to generate the one big "result" image (fixes framerate and 0 black lines!).

So, problem solved.  Though I am still curious what the problem with splice() is.  It seems like it could be pretty handy in other situations :(

Edit: Hmm, img tag does not behave as I would have expected... screenshots attached anyway
Topic black borders when pre-stitching a map By Traddles Date 2012-11-21 22:57
I'm trying to use a tileset to build a map but I found that this started really killing my framerate.  So I decided to try using TexPlay's img.splice to build up the final result image and just rendering that (rather than rending each individual tile).

Actually what I'm doing is allowing a map creator to be able to place two tiles on a given location.  This way if there is some tile that has transparent pixels, they can choose what makes sense to be behind that tile on this particular map.

For instance, 4 tiles together make up a flower, but they don't fully fill out the 4 tiles of space, so all around it are transparent pixels so that a map creator could choose to make the secondary tile full green (if the flower is on grass), or grey (if the flower is growing through a crack in the cement or some such).

However, when I use TexPlay to build up this final pre-stitched result image, I get a black boarder around tiles that have transparent pixels.

To see what I mean check out (sorry for the code, it's a bit messy at this point while I still flesh out the system)

If you swap "stich" to "false" in application/renderer.rb line 64 you'll see that the black boarders around the flowers go away.

Any ideas?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill