Пографонистей!

This commit is contained in:
Igor Timofeev 2016-06-01 06:56:33 +03:00
parent 381611493e
commit c9969e57a5
3 changed files with 36 additions and 22 deletions

View File

@ -9,7 +9,9 @@ if not component.isAvailable("gpu") then
return return
end end
ecs.prepareToExit() local xSize, ySize = gpu.getResolution()
local oldBackground = gpu.getBackground()
local oldForeground = gpu.getForeground()
local gpu = component.gpu local gpu = component.gpu
@ -35,9 +37,6 @@ local borders = {{unicode.char(0x2552), unicode.char(0x2550), unicode.char(0x255
{unicode.char(0x2502), nil, unicode.char(0x2502)}, {unicode.char(0x2502), nil, unicode.char(0x2502)},
{unicode.char(0x2514), unicode.char(0x2500), unicode.char(0x2518)}} {unicode.char(0x2514), unicode.char(0x2500), unicode.char(0x2518)}}
local xSize, ySize = gpu.getResolution()
local oldBackground = gpu.getBackground()
local oldForeground = gpu.getForeground()
gpu.setBackground(0xcccccc) gpu.setBackground(0xcccccc)
gpu.fill(1, 1, xSize, #lines + 2, " ") gpu.fill(1, 1, xSize, #lines + 2, " ")

View File

@ -1,2 +1,8 @@
local ecs = require("ECSAPI") local component = require("component")
ecs.prepareToExit() local term = require("term")
component.gpu.setBackground(_G.OSSettings.shellBackground or 0x1B1B1B)
component.gpu.setForeground(_G.OSSettings.shellBackground or 0xEEEEEE)
local width, height = component.gpu.getResolution()
component.gpu.fill(1, 1, width, height, " ")
term.setCursor(1, 1)

View File

@ -1,3 +1,5 @@
local background, foreground, logoColor = 0xCCCCCC, 0x666666, 0x262626
do do
_G._OSVERSION = "OpenOS 1.6" _G._OSVERSION = "OpenOS 1.6"
@ -42,28 +44,33 @@ do
component.invoke(gpu, "bind", screen) component.invoke(gpu, "bind", screen)
w, h = component.invoke(gpu, "maxResolution") w, h = component.invoke(gpu, "maxResolution")
component.invoke(gpu, "setResolution", w, h) component.invoke(gpu, "setResolution", w, h)
component.invoke(gpu, "setBackground", 0x000000) component.invoke(gpu, "setBackground", background)
component.invoke(gpu, "setForeground", 0xFFFFFF) component.invoke(gpu, "setForeground", foreground)
component.invoke(gpu, "fill", 1, 1, w, h, " ") component.invoke(gpu, "fill", 1, 1, w, h, " ")
end end
local y = 1
local function status(msg) local function centerText(y, text, color)
if gpu and screen then if gpu and screen then
component.invoke(gpu, "set", 1, y, msg) local msgWidth = unicode.len(text)
if y == h then local x = math.floor(w / 2 - msgWidth / 2)
component.invoke(gpu, "copy", 1, 2, w, h - 1, 0, -1) component.invoke(gpu, "fill", 1, y, w, 1, " ")
component.invoke(gpu, "fill", 1, h, w, 1, " ") component.invoke(gpu, "setForeground", color)
else component.invoke(gpu, "set", x, y, text)
y = y + 1
end
end end
end end
local y = math.floor(h / 2)
local function status(text)
centerText(y - 2, "MineOS", logoColor)
centerText(y, text, foreground)
end
status("Booting " .. _OSVERSION .. "...") status("Booting " .. _OSVERSION .. "...")
-- Custom low-level loadfile/dofile implementation reading from our ROM. -- Custom low-level loadfile/dofile implementation reading from our ROM.
local function loadfile(file) local function loadfile(file)
status("> " .. file) status("Loading " .. file)
local handle, reason = rom.open(file) local handle, reason = rom.open(file)
if not handle then if not handle then
error(reason) error(reason)
@ -94,7 +101,7 @@ do
end end
end end
status("Initializing package management...") status("Initializing package management")
-- Load file system related libraries we need to load other stuff moree -- Load file system related libraries we need to load other stuff moree
-- comfortably. This is basically wrapper stuff for the file streams -- comfortably. This is basically wrapper stuff for the file streams
@ -126,14 +133,14 @@ do
-- package.delayed["term"] = true -- package.delayed["term"] = true
end end
status("Initializing file system...") status("Initializing file system")
-- Mount the ROM and temporary file systems to allow working on the file -- Mount the ROM and temporary file systems to allow working on the file
-- system module from this point on. -- system module from this point on.
require("filesystem").mount(computer.getBootAddress(), "/") require("filesystem").mount(computer.getBootAddress(), "/")
package.preload={} package.preload={}
status("Running boot scripts...") status("Running boot scripts")
-- Run library startup scripts. These mostly initialize event handlers. -- Run library startup scripts. These mostly initialize event handlers.
local scripts = {} local scripts = {}
@ -148,7 +155,7 @@ do
dofile(scripts[i]) dofile(scripts[i])
end end
status("Initializing components...") status("Initializing components")
local primaries = {} local primaries = {}
for c, t in component.list() do for c, t in component.list() do
@ -180,6 +187,8 @@ do
runlevel = 1 runlevel = 1
-- Выставляем адекватный масштаб монитора -- Выставляем адекватный масштаб монитора
component.gpu.setBackground(background)
component.gpu.fill(1, 1, 160, 50, " ")
ecs.setScale(1) ecs.setScale(1)
end end