From 8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de Mon Sep 17 00:00:00 2001 From: jacqueline Date: Sun, 12 Nov 2023 19:14:09 +1100 Subject: Convert the main menu screen to lua lol --- lib/luavgl/examples/examples.lua | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 lib/luavgl/examples/examples.lua (limited to 'lib/luavgl/examples/examples.lua') diff --git a/lib/luavgl/examples/examples.lua b/lib/luavgl/examples/examples.lua new file mode 100644 index 00000000..64e0b631 --- /dev/null +++ b/lib/luavgl/examples/examples.lua @@ -0,0 +1,44 @@ +local container = lvgl.Object(nil, { + w = lvgl.HOR_RES(), + h = lvgl.VER_RES(), + bg_color = "#888", + bg_opa = lvgl.OPA(100), + border_width = 0, + radius = 0, + flex = { + flex_direction = "row", + flex_wrap = "wrap" + } +}) + +print("created container", container) + +local function createBtn(parent, name) + local root = parent:Object { + w = lvgl.SIZE_CONTENT, + h = lvgl.SIZE_CONTENT, + bg_color = "#ccc", + bg_opa = lvgl.OPA(100), + border_width = 0, + radius = 10, + pad_all = 20, + } + + root:onClicked(function() + container:delete() + require(name) + end) + + root:Label { + text = name, + text_color = "#333", + align = lvgl.ALIGN.CENTER, + } +end + +createBtn(container, "keyboard") +createBtn(container, "animation") +createBtn(container, "pointer") +createBtn(container, "analogTime") +createBtn(container, "flappyBird/flappyBird") +createBtn(container, "tests") -- cgit v1.2.3