-- Draconic Core Energy Reader app -- IDs for buttons local testBtnId = "test_energy_storage" -- padding for top-left placement local PADDING_X, PADDING_Y = 3, 4 -- state variables -- views local function rootView(ctx) return { draw = function(ctx, mon) local btnW, btnH = 12, 3 local x, y = PADDING_X, PADDING_Y ctx.libs().button.addButton(x, y, btnW, btnH, testBtnId, colors.lime, colors.gray, true, "test", "", x + 2, y + 1, "") ctx.libs().button.drawButton(testBtnId, mon) end, touch = function(ctx, x, y) if ctx.libs().button.isWithinBoundingBox(x, y, testBtnId) then end end } end local views = { root = rootView } return { id = "energy_storage", name = "Core", protocol = "energy_storage", receive = function(ctx, sender, message) end, create = function(ctx) end, destroy = function(ctx) end, resume = function(ctx) end, suspend = function(ctx) end, update = function(ctx, dt) end, draw = function(ctx, mon, viewId) local v = views[viewId] if v and v(ctx).draw then v(ctx).draw(ctx, mon) end end, touch = function(ctx, x, y, viewId) local v = views[viewId] if v and v(ctx).touch then v(ctx).touch(ctx, x, y) end end }