local ui = require "ui" local FONT = screen.FONT_UI ---@class HelloApp : SlateApp, TouchHandlers local M = {} local seconds = 0 local uptime local function text() return "uptime: " .. seconds .. "s" end function M.init() timer.every(1000, function() seconds = seconds + 1 ui.setText(uptime, text()) end) log.info("hello app started, screen " .. screen.getWidth() .. "x" .. screen.getHeight()) end function M.node() -- A fixed slot for the clock, because a node keeps the box it was measured with and the -- text grows a digit at a time. uptime = ui.text(text(), { w = screen.getTextWidth(FONT, "uptime: 00000s"), h = screen.getFontHeight(FONT), font = FONT, }) return ui.box { w = "fill", h = "fill", pad = 10, gap = 20, ui.text("hello from sd card", { font = FONT }), ui.text("touch the screen", { font = FONT, color = ui.theme.muted }), uptime, } end -- Painted straight to the panel rather than as nodes: the dots are a scribble, and the -- tree would need one node each to remember them. function M.onTouch(x, y) log.info("touch at " .. x .. ", " .. y) screen.fillCircle(x, y, 6, ui.theme.accent) end return M