29 lines
599 B
Lua
29 lines
599 B
Lua
local basalt = require("globals.basalt")
|
|
|
|
-- Get the main frame (your window)
|
|
local count = 0
|
|
local main = basalt.getMainFrame()
|
|
main:setBackground(colors.black)
|
|
local w,h = term.getSize()
|
|
main:addLabel({
|
|
x = w/2-(7/2)+1,
|
|
y = 2,
|
|
text = "Welcome!",
|
|
foreground = colors.yellow
|
|
})
|
|
local countLabel = main:addLabel({
|
|
x = w/2-(7/2)+1,
|
|
y = 5,
|
|
text = "0",
|
|
foreground = colors.white
|
|
})
|
|
|
|
local button = main:addButton({
|
|
x = w/2-(7/2)+1,
|
|
y = 10,
|
|
text = "Click Me!",
|
|
foreground = colors.white
|
|
}):center():onClick(function () count = count + 1 countLabel:setText(tostring(count)) end)
|
|
|
|
|
|
basalt.run() |