2018-11-20 10:41:52 +08:00
2018-11-19 21:15:47 +08:00
2018-11-20 10:27:16 +08:00
2018-11-16 13:39:13 +08:00
2018-11-16 13:39:13 +08:00
2018-11-16 13:39:13 +08:00
2018-11-16 13:39:13 +08:00
2018-11-16 13:39:13 +08:00
2018-11-19 21:15:47 +08:00
2018-11-20 10:41:52 +08:00
2018-11-20 10:41:52 +08:00
2018-11-16 14:16:46 +08:00

LTUI

A cross-platform terminal ui library based on Lua

Introduction (中文)

LTUI is a cross-platform terminal ui library based on Lua.

This framework originated from the requirements of graphical menu configuration in xmake. Similar to the kernel kernel's menuconf to configure the compilation parameters, so using curses and lua to implement a cross-platform character terminal ui library.

Refer to kconfig-frontends for style rendering. Of course, users can customize different ui styles.

Build

We need install the cross-platform build utility xmake first.

$ xmake

Examples

Application

local ltui        = require("ltui")
local application = ltui.application
local event       = ltui.event
local rect        = ltui.rect
local window      = ltui.window
local demo        = application()

function demo:init()
    application.init(self, "demo")
    self:background_set("blue")
    self:insert(window:new("window.main", rect {1, 1, self:width() - 1, self:height() - 1}, "main window", true))
end

demo:run()

Label

local lab = label:new("title", rect {0, 0, 12, 1}, "hello ltui!"):textattr_set("white")

Button

local btn = button:new("yes", rect {0, 1, 7, 2}, "< Yes >"):textattr_set("white")

Input dialog

function demo:init()
    -- ...

    local dialog_input = inputdialog:new("dialog.input", rect {0, 0, 50, 8})
    dialog_input:text():text_set("please input text:")
    dialog_input:button_add("no", "< No >", function (v) dialog_input:quit() end)
    dialog_input:button_add("yes", "< Yes >", function (v) dialog_input:quit() end)
    self:insert(dialog_input, {centerx = true, centery = true})
end

Components

views
view
panel
label
button
border
window
menubar
menuconf
textedit
textarea
statusbar
choicebox
desktop
dialogs
dialog
boxdialog
textdialog
inputdialog
mconfdialog
choicedialog

Snapshot

Menu configuation

Input dialog

Text area

Run tests

$ luajit tests\dialog.lua
$ luajit tests\window.lua
$ luajit tests\desktop.lua
$ luajit tests\inputdialog.lua
$ luajit tests\mconfdialog.lua

If you want to known more, please refer to:

Contacts

Description
port of A cross-platform terminal ui library based on Lua
Readme 560 KiB
Languages
C 66.3%
Lua 33.4%
Makefile 0.3%