What is the easiest/simplest gui library to implement?

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.
User avatar
silver_hawk
Prole
Posts: 36
Joined: Mon Feb 27, 2012 2:19 pm

What is the easiest/simplest gui library to implement?

Post by silver_hawk »

What is the easiest/simplest gui library to implement?

All i need is a few input fields and maybe buttons, but the thing I need the most is an input field for a name(string) and an ip/port (also strings), any ideas advices on this one?
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: What is the easiest/simplest gui library to implement?

Post by Jasoco »

I would also be interested in this answer. Every time I turn around someone has created a new one. I just want one I can use and stick with that has all the controls I would need for both mouse and keyboard-based input.
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: What is the easiest/simplest gui library to implement?

Post by kraftman »

If only mine were finished :(
User avatar
silver_hawk
Prole
Posts: 36
Joined: Mon Feb 27, 2012 2:19 pm

Re: What is the easiest/simplest gui library to implement?

Post by silver_hawk »

well if anybody has a good overview about pros/cons for each/some of the gui's maybe we could unify the guis somehow? :D
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: What is the easiest/simplest gui library to implement?

Post by kraftman »

silver_hawk wrote:well if anybody has a good overview about pros/cons for each/some of the gui's maybe we could unify the guis somehow? :D
its hard enough to make one let alone combine a load together :P
User avatar
silver_hawk
Prole
Posts: 36
Joined: Mon Feb 27, 2012 2:19 pm

Re: What is the easiest/simplest gui library to implement?

Post by silver_hawk »

ye, just wishful thinking, i'm not a gui expert anyway so anything I can figure out will be a great step <3
User avatar
trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

Re: What is the easiest/simplest gui library to implement?

Post by trubblegum »

The two I've used are Quickie (https://love2d.org/wiki/Quickie) and my own (https://github.com/trubblegum/Gspot).
I'd say they're equally easy to implement.

My docs are still a little shaky on some of the finer details until I get around to updating them (basic implementation has not changed since the last wiki update), but Gspot does offer a good deal of power once you get to know it (you could make a whole game out of it), and I'm always on hand to assist should questions arise.
Implementation looks like :

Code: Select all

gui = require('Gspot')
name = gui:input('name', {x, y, w, h}) -- optional label, pos, parent, value args
name.done = function(this) print(this.value) end -- element.done is called when enter is pressed while the element has focus
You still have to call gui:update(dt), gui:draw(), etc, to pass events along to the gui, but you will have to do this in any case. The repo contains a commented demo (main.lua) which explains everything you need to get started.
It has a nice flexible positioning object (operators defined, accepts 0-5 args, and dynamically changes shape), cascading styling and positioning, all the callbacks you can eat, and a few handy extras and shortcuts, like "typeout" and fading feedback text objects, auto-positioning options, a re-definable mouse getter, etc.

This is made almost entirely (not the backdrop effect) using Gspot :
A-net.love
WIP - no actual game included
(16.7 KiB) Downloaded 109 times
Most of the "action" is on the prefs screen (stateprefs.lua s.load()), but there's some potentially interesting camera stuff going on too.

I don't know of anyone else having implemented it yet, so it would be great to get some feedback. Naturally, I think it's wonderful, because I made it work in a way that I would find easy to use, and would lend itself well to making game objects.

Of course, your best bet is to look over some docs, pick a couple of likely-looking candidates, and try out some implementations to see what works best for you. You will probably end up making changes somewhere down the line anyway.

It will be hard to find someone with the time and inclination to do a full comparison of all or even most of the available libs, but there's a quick rundown of one of them anyway.


Edit : Updated the wiki this morning.
Last edited by trubblegum on Thu Apr 12, 2012 6:35 am, edited 1 time in total.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: What is the easiest/simplest gui library to implement?

Post by Jasoco »

I would want one that was dead simple and constantly maintained so I can update it easily when an update comes out and not have to switch to another because the one I was using died off.
User avatar
silver_hawk
Prole
Posts: 36
Joined: Mon Feb 27, 2012 2:19 pm

Re: What is the easiest/simplest gui library to implement?

Post by silver_hawk »

Thank you for your answers, I will try test both mentioned when I get the time, school is taking a lot atm. sadly :)
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: What is the easiest/simplest gui library to implement?

Post by vrld »

Here's how to do what you want to achieve using Quickie:

Code: Select all

local gui = require 'Quickie'

local ip = {text = ''}
local port = {text = ''}

function love.update(dt)
	gui.Label('IP:', 10,20,40,20, 'right')
	gui.Input(ip,  55,20,200,20)
	gui.Label('Port:', 10,50,40,20, 'right')
	gui.Input(port, 55,50,200,20)
	if gui.Button('connect', 55,80,200,20) then
		do_connection_stuff(ip.text, port.text)
	end
end

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

function love.keypressed(key, code)
	gui.core.keyboard.pressed(key, code)
end
The same with Gspot (note that i have no experience with GSpot, so this might be wrong)

Code: Select all

local gui = require 'Gspot'

function love.load()
	ip = gui:input("IP:", {10,20,245,20}, parent)
	port = gui:input("Port:", {10,50,245,20}, parent)
	button = gui:button("connect", {55,80,200,20})
	function button:click()
		do_connection_stuff(ip.value, port.value)
	end
end

function love.update(dt)
	gui:update(dt)
end

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

function love.keypressed(key, code)
	gui:keypress(key, code)
end

function love.mousepressed(x, y, button)
	gui:mousepress(x, y, button)
end

function love.mouserelease(x, y, button)
	gui:mouserelease(x, y, button)
end
You see that the difference is negligible. It mostly depends on what style you like better.
Jasoco wrote:I would want one that was dead simple (...)
Quicky is designed for just that. The interface is (IMO) more intuitive than retain mode guis, but more importantly writing custom widgets is super simple. Just have a look at the button and checkbox widgets to get an idea how this stuff works.
Jasoco wrote:(...) and constantly maintained so I can update it easily when an update comes out and not have to switch to another because the one I was using died off.
You could help keeping libraries active by using them and more importantly by giving feedback. When the authors get the feeling that no one uses their stuff they will most likely stop developing it. When the authors don't get bug reports/feature request they will think everything is fine and also stop developing.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
Post Reply

Who is online

Users browsing this forum: No registered users and 52 guests