toggleable fullscreen button
This commit is contained in:
@@ -3,6 +3,7 @@ local window = require("libs.window")
|
||||
local x, y = term.getSize()
|
||||
local win = window.create("Worm", x / 1.4, y / 1.4, x / 2 - ((x / 1.4) / 2), y / 2 - ((y / 1.5) / 2))
|
||||
win.resizable = false
|
||||
win.fullscreenButton = false
|
||||
sleep()
|
||||
compat.runFile("/rom/programs/fun/worm.lua", win)
|
||||
win.close()
|
||||
|
||||
@@ -83,6 +83,7 @@ function lib.create(name, w, h, x, y, do_not_add)
|
||||
decorations = true,
|
||||
alwaysOnTop = false,
|
||||
alwaysBelow = false,
|
||||
fullscreenButton = true,
|
||||
closing = false,
|
||||
_palette = {}, -- optional local palette store
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ while true do
|
||||
dragging = win
|
||||
resizing = true
|
||||
bringtofront(indx)
|
||||
elseif ((y - 1 == data[4] and x + 2 <= data[3] and x + w >= data[3] and data[2] == 1 and win.decorations) or (y <= data[4] and x <= data[3] and y + h > data[4] and x + w > data[3] and key[keys["leftAlt"]] and win.draggable)) and not win.isFullscreen then
|
||||
elseif ((y - 1 == data[4] and x + 1 + (win.fullscreenButton and 1 or 0) <= data[3] and x + w >= data[3] and data[2] == 1 and win.decorations) or (y <= data[4] and x <= data[3] and y + h > data[4] and x + w > data[3] and key[keys["leftAlt"]] and win.draggable)) and not win.isFullscreen then
|
||||
dragging = win
|
||||
offsetX = x - data[3]
|
||||
offsetY = y - data[4]
|
||||
@@ -60,7 +60,7 @@ while true do
|
||||
threading.addThread(function() win.closeRequested() end)
|
||||
bringtofront(indx)
|
||||
break
|
||||
elseif y - 1 == data[4] and x+1 == data[3] and win.decorations then
|
||||
elseif y - 1 == data[4] and x+1 == data[3] and win.decorations and win.fullscreenButton then
|
||||
threading.addThread(function() win.fullscreen() end)
|
||||
bringtofront(indx)
|
||||
break
|
||||
|
||||
@@ -99,7 +99,9 @@ local function windows()
|
||||
term.setCursorPos(x, y - 1)
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.blue)
|
||||
term.write(string.sub("XO " .. win.name .. string.rep(" ", w - #win.name - 3),1,w))
|
||||
local window_buttons = "X"
|
||||
if win.fullscreenButton then window_buttons = window_buttons.."O" end
|
||||
term.write(string.sub(window_buttons.." " .. win.name .. string.rep(" ", w - #win.name -1 -#window_buttons),1,w))
|
||||
if win.resizable and not win.isFullscreen then
|
||||
term.setCursorPos(x+w-1,y+h-1)
|
||||
term.write("\127")
|
||||
|
||||
Reference in New Issue
Block a user