fullscreen implementation
This commit is contained in:
27
startup.lua
27
startup.lua
@@ -61,10 +61,21 @@ end
|
||||
local function windows()
|
||||
term.setCursorBlink(false)
|
||||
for id, win in ipairs(_G.windows) do
|
||||
for cy = 1, win.h do
|
||||
term.setCursorPos(win.x, win.y + cy - 1)
|
||||
local h= win.h
|
||||
local w = win.w
|
||||
local x = win.x
|
||||
local y = win.y
|
||||
if win.isFullscreen then
|
||||
local sw,sh = term.getSize()
|
||||
w = sw
|
||||
h = sh-2
|
||||
x=1
|
||||
y=3
|
||||
end
|
||||
for cy = 1, h do
|
||||
term.setCursorPos(x, y + cy - 1)
|
||||
local line, fg, bg = "", "", ""
|
||||
for cx = 1, win.w do
|
||||
for cx = 1, w do
|
||||
if win.buffer[cx] then
|
||||
local cell = win.buffer[cx][cy]
|
||||
if cell then
|
||||
@@ -85,16 +96,16 @@ local function windows()
|
||||
term.blit(line, fg, bg)
|
||||
end
|
||||
if win.decorations then
|
||||
term.setCursorPos(win.x, win.y - 1)
|
||||
term.setCursorPos(x, y - 1)
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.blue)
|
||||
term.write(string.sub("X " .. win.name .. string.rep(" ", win.w - #win.name - 2),1,win.w))
|
||||
if win.resizable then
|
||||
term.setCursorPos(win.x+win.w-1,win.y+win.h-1)
|
||||
term.write(string.sub("XO " .. win.name .. string.rep(" ", w - #win.name - 3),1,w))
|
||||
if win.resizable and not win.isFullscreen then
|
||||
term.setCursorPos(x+w-1,y+h-1)
|
||||
term.write("\127")
|
||||
end
|
||||
end
|
||||
term.setCursorPos(win.x + win.cursorX - 1, win.y + win.cursorY - 1)
|
||||
term.setCursorPos(x + win.cursorX - 1, y + win.cursorY - 1)
|
||||
nterm.setCursorBlink(win.cursorBlink)
|
||||
if win.closing then
|
||||
_G.windows[id] = nil
|
||||
|
||||
Reference in New Issue
Block a user