mirror of
https://github.com/LDDestroier/CC/
synced 2024-06-26 07:03:18 +00:00
Update windont-demo.lua
This commit is contained in:
parent
31baaf3c40
commit
2563eebde1
|
@ -8,16 +8,25 @@ local x2, y2 = 13, 2
|
||||||
-- demo transformation function
|
-- demo transformation function
|
||||||
-- mess with these all you like
|
-- mess with these all you like
|
||||||
-- just remember that they apply in reverse (x and y are positions on the screen from 1 to the window's width/height)
|
-- just remember that they apply in reverse (x and y are positions on the screen from 1 to the window's width/height)
|
||||||
|
|
||||||
|
local getRandomColor = function(_cols)
|
||||||
|
local cols = _cols or "0123456789abcdef"
|
||||||
|
local p = math.random(1, #cols)
|
||||||
|
return cols:sub(p, p)
|
||||||
|
end
|
||||||
|
|
||||||
local TF = {
|
local TF = {
|
||||||
-- returns new X, new Y, and new character / text color / background color
|
-- returns new X, new Y, and new character / text color / background color
|
||||||
char = function(x, y, meta)
|
meta = function(cols)
|
||||||
return x, y, nil
|
return function(meta)
|
||||||
end,
|
for y = 1, meta.height do
|
||||||
text = function(x, y, meta)
|
for x = 1, meta.width do
|
||||||
return x, y, nil
|
if meta.buffer[2][y][x] ~= "-" then
|
||||||
end,
|
meta.buffer[3][y][x] = getRandomColor(cols)
|
||||||
back = function(x, y, meta)
|
end
|
||||||
return x, y, nil
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +38,7 @@ local scr_x, scr_y = term.current().getSize()
|
||||||
|
|
||||||
local pBlit = function(t, y, str)
|
local pBlit = function(t, y, str)
|
||||||
t.setCursorPos(1, y)
|
t.setCursorPos(1, y)
|
||||||
t.blit(str, str, str)
|
t.blit((" "):rep(#str), str, str)
|
||||||
end
|
end
|
||||||
|
|
||||||
windont = dofile("windont.lua")
|
windont = dofile("windont.lua")
|
||||||
|
@ -39,7 +48,7 @@ windont.default.alwaysRender = false
|
||||||
|
|
||||||
INSTRUCTIONS = windont.newWindow(2, scr_y - 5, scr_x - 4, 3, {backColor = "-"})
|
INSTRUCTIONS = windont.newWindow(2, scr_y - 5, scr_x - 4, 3, {backColor = "-"})
|
||||||
ONE = windont.newWindow(1, 1, 9, 5, {backColor = "e"})
|
ONE = windont.newWindow(1, 1, 9, 5, {backColor = "e"})
|
||||||
TWO = windont.newWindow(1, 1, 19, 10, {backColor = "-"})
|
TWO = windont.newWindow(1, 1, 19, 10, {backColor = "-", textColor = "-"})
|
||||||
|
|
||||||
INSTRUCTIONS.setCursorPos(1, 1)
|
INSTRUCTIONS.setCursorPos(1, 1)
|
||||||
INSTRUCTIONS.write("Arrow keys to move windon't ONE (red)")
|
INSTRUCTIONS.write("Arrow keys to move windon't ONE (red)")
|
||||||
|
@ -69,9 +78,12 @@ pBlit(TWO, 8, "ddddddddddddddddddd")
|
||||||
pBlit(TWO, 9, "ddddddddddddddddddd")
|
pBlit(TWO, 9, "ddddddddddddddddddd")
|
||||||
pBlit(TWO, 10, "ddddddddddddddddddd")
|
pBlit(TWO, 10, "ddddddddddddddddddd")
|
||||||
|
|
||||||
ONE.meta.charTransformation = TF.char
|
ONE.meta.metaTransformation = TF.meta("e-")
|
||||||
ONE.meta.textTransformation = TF.text
|
TWO.meta.metaTransformation = TF.meta(
|
||||||
ONE.meta.backTransformation = TF.back
|
string.rep("5", 50) ..
|
||||||
|
string.rep("d", 40) ..
|
||||||
|
string.rep("4", 1)
|
||||||
|
)
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user