From ac8015b2f0985dc744e287b0c8d941708c4c4cbd Mon Sep 17 00:00:00 2001 From: duncathan Date: Tue, 10 Sep 2019 04:46:45 -0600 Subject: [PATCH] adds very simple proof of concept buttons --- src/draw.lua | 4 ++++ src/layout.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/style.lua | 8 ++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/layout.lua create mode 100644 src/style.lua diff --git a/src/draw.lua b/src/draw.lua index 2577415..72aa1cd 100644 --- a/src/draw.lua +++ b/src/draw.lua @@ -8,6 +8,9 @@ local status local C = Class:extend() +local layout = Luigi(require 'layout') +layout:setStyle(require 'style') + function C:setup() Terebi.initializeLoveDefaults() screen = Terebi.newScreen(320, 240, 2) @@ -38,6 +41,7 @@ end function C:draw() screen:draw(_draw) + layout:show() end function C:setStatus(text) diff --git a/src/layout.lua b/src/layout.lua new file mode 100644 index 0000000..27f6a5f --- /dev/null +++ b/src/layout.lua @@ -0,0 +1,44 @@ +return { id = 'window', + { flow = 'y', + { height = 360 }, + { flow = 'x', + { width = false }, + { + type = 'button', + id = 'exampleButton', + text = 'Press me!', + width = 100, + height = 32, + }, + { + type = 'button', + id = 'exampleButton2', + text = 'Press me', + width = 100, + height = 32, + }, + { + type = 'button', + id = 'exampleButton3', + text = 'Press me', + width = 100, + height = 32, + }, + { + type = 'button', + id = 'exampleButton4', + text = 'Press me', + width = 100, + height = 32, + }, + { + type = 'button', + id = 'exampleButton5', + text = 'Press me', + width = 100, + height = 32, + }, + { width = false } + } + } +} \ No newline at end of file diff --git a/src/style.lua b/src/style.lua new file mode 100644 index 0000000..610e21b --- /dev/null +++ b/src/style.lua @@ -0,0 +1,8 @@ +return { + panel = { + background = {0,0,0,0} + }, + button = { + align = 'centre middle' + } +} \ No newline at end of file