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

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
end
ecs.prepareToExit()
local xSize, ySize = gpu.getResolution()
local oldBackground = gpu.getBackground()
local oldForeground = gpu.getForeground()
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(0x2514), unicode.char(0x2500), unicode.char(0x2518)}}
local xSize, ySize = gpu.getResolution()
local oldBackground = gpu.getBackground()
local oldForeground = gpu.getForeground()
gpu.setBackground(0xcccccc)
gpu.fill(1, 1, xSize, #lines + 2, " ")

View File

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