ad396d3f01
Boots to a launcher that lists /apps/<name>/main.lua on the SD card and runs the selected app in a vendored Lua 5.4 with gui, input, fs, sys and log bindings. Settings persist as a Lua table in /settings.lua, covering touch calibration and screen rotation, with a settings app to edit both. Rotation is applied after mapping raw touch into the panel's rotation-0 frame, so turning the UI never invalidates a calibration.
25 lines
631 B
Lua
25 lines
631 B
Lua
TICK_MS = 1000
|
|
|
|
local seconds = 0
|
|
local black = gui.color(0, 0, 0)
|
|
local white = gui.color(255, 255, 255)
|
|
local red = gui.color(255, 0, 0)
|
|
|
|
function setup()
|
|
gui.clear(white)
|
|
gui.drawText("hello from sd card", 10, 10, black, white)
|
|
gui.drawText("touch the screen", 10, 30, black, white)
|
|
log.info("hello app started, screen " .. gui.width() .. "x" .. gui.height())
|
|
end
|
|
|
|
function on_tick()
|
|
seconds = seconds + 1
|
|
gui.fillRect(10, 50, 120, 20, white)
|
|
gui.drawText("uptime: " .. seconds .. "s", 10, 50, black, white)
|
|
end
|
|
|
|
function on_touch(x, y)
|
|
log.info("touch at " .. x .. ", " .. y)
|
|
gui.fillCircle(x, y, 6, red)
|
|
end
|