Lua Widget Toolkit: implement cross platform GUI widgets in pure Lua on top of LPugl or LÖVE 2D game engine
OTHER License
This toolkit provides a foundation for building cross platform GUI widgets in pure Lua on top of LPugl or within the LÖVE 2D game engine. For LPugl only the cairo drawing backend is supported. Further Backend abstraction and support for other backends could be possible in the future.
This project is work in progress. First aim is to provide a basic infrastructure
for creating and customizing widgets. Second aim is to implement a reasonable set
of standard widgets. So far only very simple standard widgets are provided, e.g.
lwtk.TextInput
and lwtk.PushButton
.
The first example demonstrates a simple "Hello World" dialog. The appearance of the widgets is configured in lwtk.DefaultStyle. The key bindings are configured in lwtk.DefaultKeyBinding.
local lwtk = require("lwtk")
local Application = lwtk.Application
local Column = lwtk.Column
local Row = lwtk.Row
local PushButton = lwtk.PushButton
local TitleText = lwtk.TitleText
local Space = lwtk.Space
local app = Application("example")
local function quit()
app:close()
end
local win = app:newWindow {
title = "example",
Column {
TitleText { text = "Hello World!", style = { textSize = 35 } },
Row {
Space {},
PushButton { text = "&OK", onClicked = quit },
Space {}
}
},
}
win:show()
app:runEventLoop()