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
Happy new year!