From 5af217ac1f49f96b793aac839d79d66f29299dd0 Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Wed, 1 Feb 2023 18:59:48 +0100 Subject: [PATCH] Display an image from /boot/vendor.bmp on boot --- Capy64/Assets/bios.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Capy64/Assets/bios.lua b/Capy64/Assets/bios.lua index 6cce175..78fe9ac 100644 --- a/Capy64/Assets/bios.lua +++ b/Capy64/Assets/bios.lua @@ -1,6 +1,7 @@ local term = require("term") local timer = require("timer") local gpu = require("gpu") +local fs = require("fs") local bootSleep = 2000 local bg = 0x0 @@ -30,6 +31,27 @@ local function writeCenter(text) term.write(text) 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, 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() term.setBlink(false) @@ -100,6 +122,8 @@ local function setupScreen() end local function bootScreen() + drawVendorImage() + term.setPos(1,2) writeCenter("Capy64") term.setPos(1,4)