Update readme
This commit is contained in:
parent
b0b2e6561d
commit
cd88aa2008
1 changed files with 16 additions and 8 deletions
24
README.md
24
README.md
|
@ -8,6 +8,14 @@ SUIT is an immediate mode GUI library.
|
|||
|
||||
Over at [readthedocs](http://suit.readthedocs.org/en/latest/).
|
||||
|
||||
## Looks?
|
||||
|
||||
Here is how SUIT looks like with the default theme:
|
||||
|
||||

|
||||
|
||||
More info and code is over at [readthedocs](http://suit.readthedocs.org/en/latest/).
|
||||
|
||||
## Hello, World!
|
||||
|
||||
```lua
|
||||
|
@ -21,38 +29,38 @@ local input = {text = ""}
|
|||
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)
|
||||
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))
|
||||
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())
|
||||
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()
|
||||
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
|
||||
if suit.Button("Close", suit.layout:row()).hit then
|
||||
love.event.quit()
|
||||
end
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
-- draw the gui
|
||||
suit.core.draw()
|
||||
suit.draw()
|
||||
end
|
||||
|
||||
function love.textinput(t)
|
||||
-- forward text input to SUIT
|
||||
suit.core.textinput(t)
|
||||
suit.textinput(t)
|
||||
end
|
||||
|
||||
function love.keypressed(key)
|
||||
-- forward keypresses to SUIT
|
||||
suit.core.keypressed(key)
|
||||
suit.keypressed(key)
|
||||
end
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue