Simple User Interface Toolkit for LÖVE.
SUIT is an immediate mode GUI library.
Over at readthedocs.
Here is how SUIT looks like with the default theme:
More info and code is over at readthedocs.
-- suit uplocalsuit=require'suit'-- storage for text inputlocalinput= {text=""}
-- make love use font which support CJK textfunctionlove.load()
localfont=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 herefunctionlove.update(dt)
-- put the layout origin at position (100,100)-- the layout will grow down and to the right from this pointsuit.layout:reset(100,100)
-- put an input widget at the layout origin, with a cell size of 200 by 30 pixelssuit.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 leftsuit.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 gameifsuit.Button("Close", suit.layout:row()).hitthenlove.event.quit()
endendfunctionlove.draw()
-- draw the guisuit.draw()
endfunctionlove.textedited(text, start, length)
-- for IME inputsuit.textedited(text, start, length)
endfunctionlove.textinput(t)
-- forward text input to SUITsuit.textinput(t)
endfunctionlove.keypressed(key)
-- forward keypresses to SUITsuit.keypressed(key)
end