[examples,README] Include "Hello, World!" example.

This commit is contained in:
Lorenzo Cogotti 2022-08-17 17:04:25 +02:00
parent 82f84aa35b
commit 5332fa7320
2 changed files with 39 additions and 1 deletions

View File

@ -9,6 +9,44 @@ for games using the [LÖVE](https://love2d.org) engine.
Because I'm spending so much time tweaking and customizing existing libraries,
I might as well make my own.
## Hello, World!
```lua
local yui = require 'lib.yui'
function love.load()
local w, h = 300, 80
local x = math.floor((love.graphics.getWidth() - w) / 2)
local y = math.floor((love.graphics.getHeight() - h) / 2)
ui = yui.Ui.new {
x = x, y = y,
yui.Rows {
yui.Label {
w = w, h = h / 2,
text = "Hello, World!"
},
yui.Button {
text = "Close",
onHit = function() love.event.quit() end
}
}
}
end
function love.update(dt)
ui:update(dt)
end
function love.draw()
ui:draw()
end
```
![Hello, World!](examples/pics/hello_world.png)
## Features
**Yui** fills the following gaps:
@ -109,7 +147,7 @@ Simple User Interface Toolkit (**SUIT**) for LÖVE by Matthias Richter.
SUIT's source code is available at: [vrld/SUIT](https://github.com/vrld/SUIT).
SUIT is licensed under the [MIT license](https://github.com/vrld/suit/blob/master/license.txt).
Widgets offered by **yui** are also inspired by **SUIT**.
Widgets offered by **yui** and basic theme are also mostly taken from **SUIT**.
See [ACKNOWLEDGEMENT](README.ACKNOWLEDGEMENT) for full SUIT license
information and copyright notice.

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB