114c8c5f72
The bar is host-owned chrome: the firmware clips apps into a viewport below it, so no app can paint over it, while /lib/statusbar.lua owns the height, repaint interval and painting. gui.fullscreen() lets touch calibration take the physical panel back. Launcher and settings become grids of square cards (3 across landscape, 2 portrait) via the new gui.setTextSize, ui.label and ui.cardSide. The one function on the `app` table moves to sys.setTickInterval, alongside the new sys.appName the bar needs.
25 lines
708 B
Lua
25 lines
708 B
Lua
local ui = require("ui")
|
|
|
|
local seconds = 0
|
|
-- Draws straight to the panel rather than through components, so it reads the theme.
|
|
local theme = ui.theme
|
|
|
|
function init()
|
|
sys.setTickInterval(1000)
|
|
gui.clear(theme.bg)
|
|
gui.drawText("hello from sd card", 10, 10, theme.fg, theme.bg)
|
|
gui.drawText("touch the screen", 10, 30, theme.muted, theme.bg)
|
|
log.info("hello app started, screen " .. gui.width() .. "x" .. gui.height())
|
|
end
|
|
|
|
function on_tick()
|
|
seconds = seconds + 1
|
|
gui.fillRect(10, 50, 120, 20, theme.bg)
|
|
gui.drawText("uptime: " .. seconds .. "s", 10, 50, theme.fg, theme.bg)
|
|
end
|
|
|
|
function on_touch(x, y)
|
|
log.info("touch at " .. x .. ", " .. y)
|
|
gui.fillCircle(x, y, 6, theme.accent)
|
|
end
|