mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Display an image from /boot/vendor.bmp on boot
This commit is contained in:
parent
0068509357
commit
5af217ac1f
1 changed files with 24 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue