diff --git a/README.md b/README.md index ae345eb..d4e28ea 100644 --- a/README.md +++ b/README.md @@ -33,20 +33,58 @@ LTUI is a cross-platform terminal ui library based on Lua. ## Examples +```lua +-- requires +local ltui = require("ltui") +local application = ltui.application +local event = ltui.event +local rect = ltui.rect +local window = ltui.window + +-- the demo application +local demo = application() + +-- init demo +function demo:init() + + -- init name + application.init(self, "demo") + + -- init background + self:background_set("blue") + + -- init main window + self:insert(window:new("window.main", rect {1, 1, self:width() - 1, self:height() - 1}, "main window", true)) +end + +-- run demo +demo:run() +``` + ## Snapshot -#### menuconf +#### Menu configuation -#### inputdialog +#### Input dialog -#### textarea +#### Text area +## Run tests + +```console +$ 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: * [HomePage](https://tboox.org) diff --git a/README_zh.md b/README_zh.md index db17f0f..d003cfc 100644 --- a/README_zh.md +++ b/README_zh.md @@ -32,17 +32,70 @@ LTUI是一个基于lua的跨平台字符终端UI界面库。 +## 例子 + +```lua +-- requires +local ltui = require("ltui") +local application = ltui.application +local event = ltui.event +local rect = ltui.rect +local window = ltui.window + +-- the demo application +local demo = application() + +-- init demo +function demo:init() + + -- init name + application.init(self, "demo") + + -- init background + self:background_set("blue") + + -- init main window + self:insert(window:new("window.main", rect {1, 1, self:width() - 1, self:height() - 1}, "main window", true)) +end + +-- run demo +demo:run() +``` + +## 快照 + +#### 菜单配置 + + + +#### 输入框 + + + +#### 文本区域 + + + +## 运行测试 + +```console +$ luajit tests\dialog.lua +$ luajit tests\window.lua +$ luajit tests\desktop.lua +$ luajit tests\inputdialog.lua +$ luajit tests\mconfdialog.lua +``` 如果你想了解更多,请参考: -* [主页](http://www.tboox.org) +* [主页](https://tboox.org) * [Github](https://github.com/tboox/ltui) * [Gitee](https://gitee.com/tboox/ltui) ## 联系方式 * 邮箱:[waruqi@gmail.com](mailto:waruqi@gmail.com) -* 主页:[tboox.org](http://www.tboox.org) +* 主页:[tboox.org](https://tboox.org) * 社区:[Reddit论坛](https://www.reddit.com/r/tboox/) * 聊天:[Telegram群组](https://t.me/tbooxorg), [Gitter聊天室](https://gitter.im/tboox/tboox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) * 源码:[Github](https://github.com/tboox/ltui), [Gitee](https://gitee.com/tboox/ltui) diff --git a/tests/window.lua b/tests/window.lua index d158682..c4e98e9 100644 --- a/tests/window.lua +++ b/tests/window.lua @@ -25,8 +25,6 @@ require("tests/load") -- requires local ltui = require("ltui") -local label = ltui.label -local button = ltui.button local application = ltui.application local event = ltui.event local rect = ltui.rect