Quickie [was: Immediate Mode Gui]

Showcase your libraries, tools and other projects that help your fellow love users.
Marypop
Prole
Posts: 1
Joined: Mon Jun 30, 2014 8:11 am

Re: Quickie [was: Immediate Mode Gui]

Post by Marypop »

Hi,

I am very new to Löve, so this question is probably silly - but I could not find an answer in the discussion above.

I would like to be able to customize differently each button (for instance set the button 1 background to image1, the button 2 background to image2, etc).
So I can't really change the style-default file.

Is there any way to do something like that :

Code: Select all


function love.load()
	image1 = love.graphics.newImage("Images/Button1.png")
end

function love.update(dt)
      if gui.Button ({text = "Blabla",image1, pos = {300, 200}, size = {200, 50}}) 
         	then -- do something
      end
end

Thanks a lot !
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: Quickie [was: Immediate Mode Gui]

Post by murks »

As far as I can tell you need to write your own button class. You can base it on the default button class.
You also need to add your new class to init.lua and style-default.lua.
Lolocks
Prole
Posts: 12
Joined: Tue Jul 15, 2014 3:06 pm

Re: Quickie [was: Immediate Mode Gui]

Post by Lolocks »

I like this and I'd love to use it.

But can you provide instructions on how to add it to one's current project?
Lolocks
Prole
Posts: 12
Joined: Tue Jul 15, 2014 3:06 pm

Re: Quickie [was: Immediate Mode Gui]

Post by Lolocks »

No seriously there's like nothing anywhere with instructions on how I can add Quickie to my current project. Could anyone help?
flyingjam
Prole
Posts: 2
Joined: Fri Jul 11, 2014 11:29 am

Re: Quickie [was: Immediate Mode Gui]

Post by flyingjam »

You load the library by adding something like

Code: Select all

gui = require "Quickie"
to the top of your main/game lua (in this case, move the folder with all the library files into where main.lua is and name it 'Quickie'.). From then on, you can just call the function to add a button or whatever form you want in update. Make sure to draw it. Here's some super simple example code

Code: Select all

gui = require "Quickie"

function love.load()
end

function love.update(dt)
gui.Button{text = "foo"} --this creates a button that does nothing with the text "foo"
if gui.Button{text = "bar", pos = {50, 50}} then --this creates a button that has the text "bar", a position of 50,50, and prints "foobar" when you click on it. The functions you call return true if they are activated.
print("foobar")
end

end

function love.draw()
gui.core.draw()
end

You can generally get how to use most of them from looking at the example code on github.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: Quickie [was: Immediate Mode Gui]

Post by murks »

I wish I could release my game (still waiting for a single asset to be replaced). There you could see how it is used in a real game and also how I solved some of the problems I encountered along the way (keyboard focus with multiple menu screens, sound on button mouseover).

From my experience I'd say only use quickie if what you need is really simple, like a single menu screen for example. Mind you, I don't have any experience with the ohter Löve GUIs, but I'll try one of those for my next project.
Lolocks
Prole
Posts: 12
Joined: Tue Jul 15, 2014 3:06 pm

Re: Quickie [was: Immediate Mode Gui]

Post by Lolocks »

flyingjam wrote:You load the library by adding something like

Code: Select all

gui = require "Quickie"
to the top of your main/game lua (in this case, move the folder with all the library files into where main.lua is and name it 'Quickie'.). From then on, you can just call the function to add a button or whatever form you want in update. Make sure to draw it. Here's some super simple example code

Code: Select all

gui = require "Quickie"

function love.load()
end

function love.update(dt)
gui.Button{text = "foo"} --this creates a button that does nothing with the text "foo"
if gui.Button{text = "bar", pos = {50, 50}} then --this creates a button that has the text "bar", a position of 50,50, and prints "foobar" when you click on it. The functions you call return true if they are activated.
print("foobar")
end

end

function love.draw()
gui.core.draw()
end

You can generally get how to use most of them from looking at the example code on github.
Thanks!
Also, I don't have to keep the .gitignore file, correct?
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: Quickie [was: Immediate Mode Gui]

Post by murks »

You don't need to keep a .gitignore file or .git directory if all you want to do is use quickie. Both are just related to version control and are not necessary for quickie to work.
User avatar
danbo
Prole
Posts: 18
Joined: Thu Jan 03, 2013 8:11 pm

Re: Quickie [was: Immediate Mode Gui]

Post by danbo »

Hi there! I hope I haven't missed an answer to this question, but I'd like to override the mouse position getter for Quickie. I don't really know much about metatables etc, but given that it's mentioned in this commit, how do I do this?

https://github.com/vrld/Quickie/blob/master/mouse.lua

Love the library btw
User avatar
Snuux
Prole
Posts: 49
Joined: Sun Dec 15, 2013 10:43 am
Location: Russia, Moskow
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by Snuux »

Good day! How can I change the color of a separate block of text (label for example)?
My library for easy saving Slib! Try this! Now you can encrypt your save!
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
Post Reply

Who is online

Users browsing this forum: No registered users and 91 guests