Help, need buttons.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Help, need buttons.
All ways i found to create buttons are really messy and ineffective, anyone has any suggestions for main menu buttons?
Re: Help, need buttons.
What ways have you found? There's a few libraries on the wiki that're quite good, like Quickie and LoveFrames.
http://www.love2d.org/wiki/Category:Libraries
http://www.love2d.org/wiki/Category:Libraries
Re: Help, need buttons.
Emm, all i could think of was checking coordinates every time left mouse button has been pressed down, but my menu consists of 6 diffrent choices, that would take a lot of lines of code, so i didnt bother.
Re: Help, need buttons.
Checking the mouse coordinates and matching it against any active buttons is pretty much the way to go. But the libraries I mentioned will do it for you.
Re: Help, need buttons.
How about simply putting every button in a table, so you could just iterate over them, like this:
Code: Select all
for i = 1, #buttons do
if mouseX > buttons[i].x
and mouseX < buttons[i].width + buttons[i].x
and mouseY > buttons[i].y
and mouseY < buttons[i].height + buttons[i].y then
--your code
end
end
Re: Help, need buttons.
Well, check out Sock Munkee dev's video on it, if all you need are simple text buttons, but if you want to make GUI's and some better looking buttons, I'd say look into LöveFrames. It's very easy to use, there is extensive documentation on it and(PLUG!) I make my own tutorial series on LÖVE, and all I have to do is upload those episodes tonight and you could follow those to learn how to make buttons. I would suggest at least checking out some of those libraries: They could save you a lot of headaches.
"In those quiet moments, you come into my mind" - Liam Reilly
Re: Help, need buttons.
I have a little problem using other peoples codes, i can't really understand what is going on if i haven't made it myself
Re: Help, need buttons.
That's a common thing actually. It gets especially bad if people don't format their code properly - don't use tabs *coughjjmafiaecough* or whitespaces *coughmonkeymancough*. And of course if they don't comment obscure algorithms *couggthembothandmanyotherscough* it gets REALLY hard to read others' code.
Re: Help, need buttons.
I think he means more along the lines of something like this:
Since they didn't make it, they don't know how it works. That's at least true for me.
Since they didn't make it, they don't know how it works. That's at least true for me.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: Help, need buttons.
I always like a thorough explanation of what the code does, so I can be able to write my own version of it.
Code: Select all
L
L Ö
Ö V
L Ö V E
Ö B E
V E
E Y
Who is online
Users browsing this forum: Bing [Bot] and 11 guests