Display an image from /boot/vendor.bmp on boot

This commit is contained in:
Alessandro Proto 2023-02-01 18:59:48 +01:00
parent 0068509357
commit 5af217ac1f

View file

@ -1,6 +1,7 @@
local term = require("term") local term = require("term")
local timer = require("timer") local timer = require("timer")
local gpu = require("gpu") local gpu = require("gpu")
local fs = require("fs")
local bootSleep = 2000 local bootSleep = 2000
local bg = 0x0 local bg = 0x0
@ -30,6 +31,27 @@ local function writeCenter(text)
term.write(text) term.write(text)
end end
local function drawVendorImage()
if not fs.exists("/boot/vendor.bmp") then
return
end
local w, h = gpu.getSize()
local ok, err = pcall(function()
local buffer<close>, width, height = gpu.loadImage("/boot/vendor.bmp")
local x, y =
math.ceil((w / 2) - (width / 2)),
math.ceil((h / 2) - (height / 2))
gpu.drawBuffer(buffer, x, y, width, height)
end)
if not ok then
print("Warning: Could not draw vendor.bmp", err)
end
end
local w, h = term.getSize() local w, h = term.getSize()
term.setBlink(false) term.setBlink(false)
@ -100,6 +122,8 @@ local function setupScreen()
end end
local function bootScreen() local function bootScreen()
drawVendorImage()
term.setPos(1,2) term.setPos(1,2)
writeCenter("Capy64") writeCenter("Capy64")
term.setPos(1,4) term.setPos(1,4)