How do you make Gui text buttons and moving pictures?

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
TheEbonyAssassin
Prole
Posts: 1
Joined: Tue Apr 03, 2012 6:15 pm

How do you make Gui text buttons and moving pictures?

Post by TheEbonyAssassin »

Hello, I am a new Love user and i would like to learn how to make Gui Text Buttons. I am quite a good lua scripter just I have absolutely no idea how you can do this. Also, how can you make "Moving pictures?" Thanks.
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: How do you make Gui text buttons and moving pictures?

Post by Ensayia »

There is no built in GUI library for making buttons, text inputs, or anything of the sort as there really isn't a nice clean way to support those features on all three operating systems LOVE runs on. You can use one of the community made ones in the Libraries section of the wiki or make your own if you choose.

As for 'moving pictures', I assume you mean animation? Look for AnAL in the libraries section as well, it's pretty much the cleanest implementation as of now, and LOVE doesn't support animated file types (GIF, APNG, etc...).
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: How do you make Gui text buttons and moving pictures?

Post by Petunien »

Regarding the Buttons... you could use one of the GUI-libraries:

https://love2d.org/wiki/Goo
https://love2d.org/wiki/Gwee
https://love2d.org/wiki/Quickie
https://love2d.org/wiki/LoveUI

Or make your own graphic button (easily an image with GIMP) and check for the mouse position and clicks, so if the user clicks into the button area do something.

And then, what do you mean with "moving pictures"?
Pictures that moving around in the window?

Just use the x/y coordinate, as example:

Code: Select all

function love.load()

	imgX = 300
	imgY = 300
end

function love.update(dt)

	imgX = imgX + 1
	imgY = imgY + 1	
end

function love.draw()

	love.graphics.rectangle("fill", imgX, imgY, 20, 20)
end
The little rectangle will increase its x and y coordinate + 1 every frame.
Same works with images. :)

Greets
"Docendo discimus" - Lucius Annaeus Seneca
Post Reply

Who is online

Users browsing this forum: slime and 2 guests