Page 1 of 1

Image creation in LOVE

Posted: Thu Oct 15, 2009 4:51 am
by zugamifk
So I'm currently working on a tile based rpg and I was wondering, would it be possible to get an image of the entire map using a screenshot, or is it limited to what is seen in the window? I've tried drawing the entire map at once and it doesn't work. What I want is to get an image that contains the 500x500 tile grid rather than just the ~25x~36 tiles I have visible on the screen.

Is there anyway around this?

My other question: is there a way for LOVE to create image files by stacking one image on top of the other and saving it as a new image? Say, a naked character image with its clothing as separate images saved together as a single image. Can LOVE create images at all?

Re: Image creation in LOVE

Posted: Thu Oct 15, 2009 1:45 pm
by TechnoCat
The image library of 0.5.0 was split up into love.image and love.graphics in 0.6.0 just to accommodate people wanting to generate pictures.

Re: Image creation in LOVE

Posted: Thu Oct 15, 2009 4:25 pm
by zugamifk
Really? Where can I find info on love.image? There doesn't seem to be anything on the wiki about it.

Re: Image creation in LOVE

Posted: Thu Oct 15, 2009 5:54 pm
by TechnoCat
I'm afraid the answer to that is pretty meek. It is still under development and isn't feature complete. All the source code is available and is usually commented, but there is no documentation on it yet.

http://love2d.org/wiki/index.php?title= ... e.graphics

The SpriteBatch object is built on top of VertexBuffer, and is also almost ready, but it will most likely not make it into 0.6.0. We'll see.
-- Makes things like tilemaps much faster.

Code: Select all

sb = love.graphics.newSpriteBatch( size )
sb:add( image, x, y, angle, sx, sy, ox, oy )
love.graphics.draw( sb )
Also planned are FrameBuffers.

Code: Select all

fb = love.graphics.newFrameBuffer( width, height )
love.graphics.setFrameBuffer( fb )
love.graphics.draw( image, x, y ) -- draws into fb.
love.graphics.setFrameBuffer() -- Change back to screen.
love.graphics.draw( fb, 0, 0, 0, 2, 2) -- Draw the framebuffer to the screen (scaled).
Further, we have Frames:

Code: Select all

frame = love.graphics.newFrame( image, x, y, w, h )
love.graphics.draw( frame, x, y, angle, sx, sy, ox, oy )
 
-- API:
frame = love.graphics.newFrame( image ) -- Entire image (not directly useful).
frame = love.graphics.newFrame( image, x, y, w, h ) -- Part of image.
frame = love.graphics.newFrame( image, s0,t0,s1,t1,s2,t2,s3,t3 ) -- Custom texels entire image.
frame = love.graphics.newFrame( image, x, y, w, h, s0,t0,s1,t1,s2,t2,s3,t3 ) -- Custom texels part of image.
frame:flip( x, y ) -- Flips the frame horizontally (x=true) and/or vertically (y=true)
love.graphics.draw(frame, x, y, angle, sx, sy, ox, oy)
I'm not sure if any of this is even in 0.6.0 yet.

Re: Image creation in LOVE

Posted: Sat Oct 17, 2009 3:19 am
by zugamifk
Oh my, those all sound like incredibly useful things. I'd love to see those in 0.6.0.

I guess I'll have to wait, the more I hear about 0.6.0, the more excited I get.

Re: Image creation in LOVE

Posted: Sat Oct 17, 2009 8:30 am
by Robin
zugamifk wrote:I guess I'll have to wait, the more I hear about 0.6.0, the more excited I get.
You could always try the "unstable" builds at http://love2d.org/builds/ ^^