Image creation in LOVE

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
zugamifk
Prole
Posts: 28
Joined: Sun Jul 26, 2009 4:01 pm

Image creation in LOVE

Post by zugamifk » Thu Oct 15, 2009 4:51 am

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?

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Image creation in LOVE

Post by TechnoCat » Thu Oct 15, 2009 1:45 pm

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.

User avatar
zugamifk
Prole
Posts: 28
Joined: Sun Jul 26, 2009 4:01 pm

Re: Image creation in LOVE

Post by zugamifk » Thu Oct 15, 2009 4:25 pm

Really? Where can I find info on love.image? There doesn't seem to be anything on the wiki about it.

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Image creation in LOVE

Post by TechnoCat » Thu Oct 15, 2009 5:54 pm

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.

User avatar
zugamifk
Prole
Posts: 28
Joined: Sun Jul 26, 2009 4:01 pm

Re: Image creation in LOVE

Post by zugamifk » Sat Oct 17, 2009 3:19 am

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.

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Image creation in LOVE

Post by Robin » Sat Oct 17, 2009 8:30 am

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/ ^^
Help us help you: attach a .love.

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests