Skip to content
Immediate Mode GUI library for LÖVE
Lua
Branch: master
Clone or download
Latest commit 1767782 Jan 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Fix a sentence in docs Feb 1, 2019
.gitignore LET THERE BE SUIT! Dec 31, 2015
README.md fix 'Input widget will raise error when candidate_text field is not d… Oct 31, 2017
button.lua
checkbox.lua
core.lua Fix #70: overlapping buttons both react to hover Jun 17, 2018
imagebutton.lua Fixed ImageButton checking mask bounds on mask instead of image Aug 12, 2018
init.lua fix 'Input widget will raise error when candidate_text field is not d… Oct 31, 2017
input.lua fix 'Input widget will raise error when candidate_text field is not d… Oct 31, 2017
label.lua
layout.lua Remove nextUp() and nextLeft() Oct 5, 2016
license.txt LET THERE BE SUIT! Dec 31, 2015
slider.lua Allow to overwrite draw function per widget Jan 16, 2016
suit-0.1-1.rockspec Fix rockspec Apr 8, 2018
theme.lua Updated to love 11.0 Apr 5, 2018

README.md

SUIT

Simple User Interface Toolkit for LÖVE.

SUIT is an immediate mode GUI library.

Documentation?

Over at readthedocs.

Looks?

Here is how SUIT looks like with the default theme:

Demo of all widgets

More info and code is over at readthedocs.

Hello, World!

-- suit up
local suit = require 'suit'

-- storage for text input
local input = {text = ""}

-- make love use font which support CJK text
function love.load()
    local font = love.graphics.newFont("NotoSansHans-Regular.otf", 20)
    love.graphics.setFont(font)
end

-- all the UI is defined in love.update or functions that are called from here
function love.update(dt)
	-- put the layout origin at position (100,100)
	-- the layout will grow down and to the right from this point
	suit.layout:reset(100,100)

	-- put an input widget at the layout origin, with a cell size of 200 by 30 pixels
	suit.Input(input, suit.layout:row(200,30))

	-- put a label that displays the text below the first cell
	-- the cell size is the same as the last one (200x30 px)
	-- the label text will be aligned to the left
	suit.Label("Hello, "..input.text, {align = "left"}, suit.layout:row())

	-- put an empty cell that has the same size as the last cell (200x30 px)
	suit.layout:row()

	-- put a button of size 200x30 px in the cell below
	-- if the button is pressed, quit the game
	if suit.Button("Close", suit.layout:row()).hit then
		love.event.quit()
	end
end

function love.draw()
	-- draw the gui
	suit.draw()
end

function love.textedited(text, start, length)
    -- for IME input
    suit.textedited(text, start, length)
end

function love.textinput(t)
	-- forward text input to SUIT
	suit.textinput(t)
end

function love.keypressed(key)
	-- forward keypresses to SUIT
	suit.keypressed(key)
end
You can’t perform that action at this time.