## [Lib] SUIT - Simple User Interface Toolkit

vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

### [Lib] SUIT - Simple User Interface Toolkit

It has taken a while, but the immediate mode GUI library formerly known as Quickie has gotten a much needed makeover. The changes are so severe, that it is fair to call it a different name. Thus, I give to you:

SUIT

The Simple/Smart/...Succulent? User Interface Toolkit for LÖVE.

SUIT takes quite a different approach to user interfaces than most other libraries: immediate, instead of retained mode. In a nutshell, this means that widgets are not objects, but functions, and that you create the entire UI every frame from scratch.

Like my other libraries, SUIT was developed by observing what my needs when programming games and then filtering out the particular techniques. The previous installment, Quickie, became bigger and clunky over time, as new features were added and issues were uncovered. In the end, I couldn't even remember how the API worked, which is usually a very bad sign. SUIT is a rewrite of the core concepts with a very clear API that allows to construct GUIs with very few lines of code.

But enough talk, here is the hello world of SUIT: edit: updated code to reflect current API

Code: Select all

local suit = require 'suit' -- suit up

local input = {text = ""} -- text input data

-- the entire UI is defined inside love.update(dt) (or functions that are called from love.update)
function love.update(dt)
suit.layout:reset(100,100)

suit.Input(input, suit.layout:row(200,30))
suit.Label("Hello, "..input.text, {align = "left"}, suit.layout:row())

suit.layout:row() -- padding of one cell
if suit.Button("Close", suit.layout:row()).hit then
love.event.quit()
end
end

function love.draw()
suit.draw()
end

function love.textinput(t)
suit.textinput(t)
end

function love.keypressed(key)
suit.keypressed(key)
end
The above produces the following:
suitup.png (2.36 KiB) Viewed 8228 times
As always, you can take a look at the code over at github. The (still incomplete) documentation is hosted at readthedocs.

Happy new year!
Last edited by vrld on Sun Jan 03, 2016 6:20 pm, edited 1 time in total.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

### Re: [Lib] SUIT - Simple User Interface Toolkit

I haven't used Quickie nor this yet but I really like the idea of everything happening in the update function. I've found that doing things this way usually leads to simpler code. I'll try using this to see if it fits my needs too, thanks!

s-ol
Party member
Posts: 1076
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: [Lib] SUIT - Simple User Interface Toolkit

I really liked Quickie so I will definetely give this a try. Immediate mode UIs are interesting but it feels a bit weird to me to keep the state around in a seperate variable sometimes, if the state is not just the exact result that I want to "prompt" the user for with the UI basically.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

OttoRobba
Party member
Posts: 104
Joined: Mon Jan 06, 2014 5:02 am
Location: Sao Paulo, Brazil

### Re: [Lib] SUIT - Simple User Interface Toolkit

Seems pretty good, I like it! API is pretty clean. :-)

Ortimh
Citizen
Posts: 90
Joined: Tue Sep 09, 2014 5:07 am
Location: Indonesia

### Re: [Lib] SUIT - Simple User Interface Toolkit

Great library. Love the name by the way. Maybe I will SUIT up.

parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

### Re: [Lib] SUIT - Simple User Interface Toolkit

Dream come true, thanks for reworking quickie and adding in these cool new features! The docs are fun to read to boot

vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

### Re: [Lib] SUIT - Simple User Interface Toolkit

Tons of updates! Ok, four, but still:
I've attached the big demo that shows ALL THE WIDGETS so you can get a feel for them. Here is how they look, anyway:

Interestingly, the fourth update can be used to implement overlapping windows with SUIT. A demo is attached. This will not become part of the main library, though.
S0lll0s wrote:Immediate mode UIs are interesting but it feels a bit weird to me to keep the state around in a seperate variable sometimes, if the state is not just the exact result that I want to "prompt" the user for with the UI basically.
But you do that with retained mode GUI toolkits, too. The only difference is that they lump behavior with the state, too (and call it OOP). If Lua would have pointers or C++-style references, the API could be more concise, e.g.: Slider(&value, {min = 0, max = 100}), but I don't think the table "hack" is too bad.
Attachments
bigdemo.love
windows.love
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

pgimeno
Party member
Posts: 1495
Joined: Sun Oct 18, 2015 2:58 pm

### Re: [Lib] SUIT - Simple User Interface Toolkit

Looking great and working great!

It seems main.lua in the repository is deprecated. Could it be either updated or removed to avoid people being confused by it?
EDIT: Oops, my bad. The problem is that main.lua is in .gitignore, not in the repository, and the main.lua I had didn't work.
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories - portland (mobile orientation)
The MS-Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

akciom
Prole
Posts: 1
Joined: Mon Jan 04, 2016 12:05 am

### Re: [Lib] SUIT - Simple User Interface Toolkit

I was taking a look at Quickie awhile back and liked what it had to offer but found it to be quite messy. Thank you, I appreciate the work you put in to clean it up.

Prole
Posts: 15
Joined: Wed Jan 15, 2014 8:38 am

### Re: [Lib] SUIT - Simple User Interface Toolkit

Excellent!

SUIT need 0.10?

How about "Hold Backspace to delete multiple characters"?

### Who is online

Users browsing this forum: Alexar and 7 guests