updated kernel and working on oc tty impl
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
Hyperion
|
||||
Astronand
|
||||
@@ -0,0 +1,40 @@
|
||||
--:Minify:--
|
||||
local lib = {}
|
||||
|
||||
function lib.frame(frame)
|
||||
local handle = {}
|
||||
|
||||
function handle.setPixel(x,y,color24)
|
||||
|
||||
end
|
||||
|
||||
function handle.getPixel(x,y)
|
||||
|
||||
end
|
||||
|
||||
function handle.setPixels(x,y,framebuffer)
|
||||
|
||||
end
|
||||
|
||||
function handle.getPixels(x,y,w,h)
|
||||
|
||||
end
|
||||
|
||||
function handle.frame(x,y,w,h,writeonly)
|
||||
|
||||
end
|
||||
|
||||
function handle.framectl(id,x,y,w,h,writeonly)
|
||||
|
||||
end
|
||||
|
||||
function handle.drawframe()
|
||||
|
||||
end
|
||||
|
||||
function handle.line()
|
||||
|
||||
end
|
||||
|
||||
return handle
|
||||
end
|
||||
@@ -0,0 +1,232 @@
|
||||
-- psf.lua
|
||||
-- NeetComputers PSF1 & PSF2 font renderer
|
||||
|
||||
-- Copyright 2026 SpartanSoftware
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
-- MODULE API
|
||||
-- psf.open(path, disk = 0) Returns a Font object, or nil + errmsg
|
||||
--
|
||||
-- FONT OBJECT API
|
||||
-- font:print(x, y, text) Draw text in white
|
||||
-- font:print(x, y, text, r, g, b) Draw text in given color
|
||||
-- font:measure(text) Width of string in pixels
|
||||
-- font:lineHeight() Font height in pixels
|
||||
-- font:setSpacing(w) Set px width of glyph spacing
|
||||
-- font:close() Free all layers
|
||||
|
||||
local psf = {}
|
||||
|
||||
local function readUInt(header, n)
|
||||
local bytes = header.read(n)
|
||||
if not bytes or #bytes < n then return nil end
|
||||
local value = 0
|
||||
for i = 1, n do
|
||||
value = value + string.byte(bytes, i) * (256 ^ (i - 1))
|
||||
end
|
||||
return math.floor(value)
|
||||
end
|
||||
|
||||
local function parseGlyph(bytes, w, h)
|
||||
local bytesPerRow = math.floor((w + 7) / 8)
|
||||
local pixels = {}
|
||||
for y = 1, h do
|
||||
pixels[y] = {}
|
||||
for x = 1, w do
|
||||
local byteIdx = (y - 1) * bytesPerRow + math.floor((x - 1) / 8) + 1
|
||||
local bitPos = 7 - ((x - 1) % 8)
|
||||
local b = string.byte(bytes, byteIdx) or 0
|
||||
pixels[y][x] = (math.floor(b / (2 ^ bitPos)) % 2 == 1)
|
||||
end
|
||||
end
|
||||
return pixels
|
||||
end
|
||||
|
||||
local OFF_PIXEL = "\0\0\0\0"
|
||||
|
||||
local function getGlyphBuffer(glyph, r, g, b)
|
||||
local cache = glyph._bufCache
|
||||
if not cache then
|
||||
cache = {}
|
||||
glyph._bufCache = cache
|
||||
end
|
||||
|
||||
local key = r * 65536 + g * 256 + b
|
||||
local buf = cache[key]
|
||||
if buf then return buf end
|
||||
|
||||
local onPixel = string.char(r, g, b, 255)
|
||||
local pixels = glyph.pixels
|
||||
local chunks = {}
|
||||
local n = 0
|
||||
|
||||
for y = 1, glyph.height do
|
||||
local row = pixels[y]
|
||||
for x = 1, glyph.width do
|
||||
n = n + 1
|
||||
chunks[n] = row[x] and onPixel or OFF_PIXEL
|
||||
end
|
||||
end
|
||||
|
||||
buf = table.concat(chunks)
|
||||
cache[key] = buf
|
||||
return buf
|
||||
end
|
||||
|
||||
local function parsePSF1(header, glyphs)
|
||||
local mode = readUInt(header, 1)
|
||||
local charsize = readUInt(header, 1)
|
||||
if not charsize then return false, "truncated PSF1 header" end
|
||||
|
||||
local count = (mode and (mode % 4 >= 2)) and 512 or 256
|
||||
for i = 0, count - 1 do
|
||||
local raw = header.read(charsize)
|
||||
if not raw or #raw < charsize then break end
|
||||
glyphs[i] = { width = 8, height = charsize,
|
||||
pixels = parseGlyph(raw, 8, charsize) }
|
||||
end
|
||||
return true, 8, charsize
|
||||
end
|
||||
|
||||
local function parsePSF2(header, glyphs)
|
||||
readUInt(header, 4)
|
||||
local headersize = readUInt(header, 4)
|
||||
readUInt(header, 4)
|
||||
local numglyph = readUInt(header, 4)
|
||||
local bytesperglyph = readUInt(header, 4)
|
||||
local h = readUInt(header, 4)
|
||||
local w = readUInt(header, 4)
|
||||
if not w or not h then return false, "truncated PSF2 header" end
|
||||
|
||||
local consumed = 32
|
||||
if headersize > consumed then
|
||||
header.seek('cur', headersize - consumed)
|
||||
end
|
||||
|
||||
for i = 0, numglyph - 1 do
|
||||
local raw = header.read(bytesperglyph)
|
||||
if not raw or #raw < bytesperglyph then break end
|
||||
glyphs[i] = { width = w, height = h,
|
||||
pixels = parseGlyph(raw, w, h) }
|
||||
end
|
||||
return true, w, h
|
||||
end
|
||||
|
||||
local Font = {}
|
||||
Font.__index = Font
|
||||
|
||||
function Font:print(x, y, text, r, g, b)
|
||||
assert(not self._closed, "psf: font has been closed")
|
||||
|
||||
r = r or 255
|
||||
g = g or 255
|
||||
b = b or 255
|
||||
|
||||
local sw = screen.getSize()
|
||||
local cur = x
|
||||
local spacing = self._spacing
|
||||
|
||||
for i = 1, #text do
|
||||
if cur >= sw then break end
|
||||
local code = string.byte(text, i)
|
||||
local glyph = self._glyphs[code]
|
||||
if glyph then
|
||||
local buf = getGlyphBuffer(glyph, r, g, b)
|
||||
screen.drawPixels(cur, y, buf, glyph.width, glyph.height)
|
||||
cur = cur + glyph.width + spacing
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Font:measure(text)
|
||||
local w = 0
|
||||
local count = 0
|
||||
for i = 1, #text do
|
||||
local g = self._glyphs[string.byte(text, i)]
|
||||
if g then
|
||||
w = w + g.width
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
if count > 1 then
|
||||
w = w + self._spacing * (count - 1)
|
||||
end
|
||||
return w
|
||||
end
|
||||
|
||||
function Font:lineHeight()
|
||||
return self._height
|
||||
end
|
||||
|
||||
function Font:close()
|
||||
if self._closed then return end
|
||||
for _, glyph in pairs(self._glyphs) do
|
||||
glyph._bufCache = nil
|
||||
end
|
||||
self._glyphs = {}
|
||||
self._closed = true
|
||||
end
|
||||
|
||||
function Font:setSpacing(px)
|
||||
self._spacing = px
|
||||
end
|
||||
|
||||
function psf.open(path, disk)
|
||||
disk = disk or 0
|
||||
|
||||
if not files.exists(path, disk) then
|
||||
return nil, "file not found: " .. path
|
||||
end
|
||||
|
||||
local ok, header = pcall(files.open, path, 'rb', disk)
|
||||
if not ok or not header then
|
||||
return nil, "could not open: " .. path
|
||||
end
|
||||
|
||||
local magic = header.read(2)
|
||||
if not magic or #magic < 2 then
|
||||
header.close()
|
||||
return nil, "could not read magic bytes"
|
||||
end
|
||||
|
||||
local b1, b2 = string.byte(magic, 1), string.byte(magic, 2)
|
||||
local glyphs = {}
|
||||
local ok, w, h
|
||||
|
||||
if b1 == 0x36 and b2 == 0x04 then
|
||||
ok, w, h = parsePSF1(header, glyphs)
|
||||
elseif b1 == 0x72 and b2 == 0xb5 then
|
||||
header.read(2)
|
||||
ok, w, h = parsePSF2(header, glyphs)
|
||||
else
|
||||
header.close()
|
||||
return nil, string.format("not a PSF file (magic: %02x %02x)", b1, b2)
|
||||
end
|
||||
|
||||
header.close()
|
||||
|
||||
if not ok then
|
||||
return nil, w
|
||||
end
|
||||
|
||||
return setmetatable({
|
||||
_glyphs = glyphs,
|
||||
_width = w,
|
||||
_height = h,
|
||||
_spacing = 0,
|
||||
_closed = false,
|
||||
}, Font)
|
||||
end
|
||||
|
||||
return psf
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
package providing kernel support for framebuffers and graphics
|
||||
+256
@@ -0,0 +1,256 @@
|
||||
#000000
|
||||
#0b0b0b
|
||||
#222222
|
||||
#444444
|
||||
#555555
|
||||
#777777
|
||||
#888888
|
||||
#aaaaaa
|
||||
#bbbbbb
|
||||
#dddddd
|
||||
#eeeeee
|
||||
#00000b
|
||||
#000022
|
||||
#000044
|
||||
#000055
|
||||
#000077
|
||||
#000088
|
||||
#0000aa
|
||||
#0000bb
|
||||
#0000dd
|
||||
#0000ee
|
||||
#000b00
|
||||
#002200
|
||||
#004400
|
||||
#005500
|
||||
#007700
|
||||
#008800
|
||||
#00aa00
|
||||
#00bb00
|
||||
#00dd00
|
||||
#00ee00
|
||||
#0b0000
|
||||
#220000
|
||||
#440000
|
||||
#550000
|
||||
#770000
|
||||
#880000
|
||||
#aa0000
|
||||
#bb0000
|
||||
#dd0000
|
||||
#ee0000
|
||||
#000033
|
||||
#000066
|
||||
#000099
|
||||
#0000cc
|
||||
#0000ff
|
||||
#003300
|
||||
#003333
|
||||
#003366
|
||||
#003399
|
||||
#0033cc
|
||||
#0033ff
|
||||
#006600
|
||||
#006633
|
||||
#006666
|
||||
#006699
|
||||
#0066cc
|
||||
#0066ff
|
||||
#009900
|
||||
#009933
|
||||
#009966
|
||||
#009999
|
||||
#0099cc
|
||||
#0099ff
|
||||
#00cc00
|
||||
#00cc33
|
||||
#00cc66
|
||||
#00cc99
|
||||
#00cccc
|
||||
#00ccff
|
||||
#00ff00
|
||||
#00ff33
|
||||
#00ff66
|
||||
#00ff99
|
||||
#00ffcc
|
||||
#00ffff
|
||||
#330000
|
||||
#330033
|
||||
#330066
|
||||
#330099
|
||||
#3300cc
|
||||
#3300ff
|
||||
#333300
|
||||
#333333
|
||||
#333366
|
||||
#333399
|
||||
#3333cc
|
||||
#3333ff
|
||||
#336600
|
||||
#336633
|
||||
#336666
|
||||
#336699
|
||||
#3366cc
|
||||
#3366ff
|
||||
#339900
|
||||
#339933
|
||||
#339966
|
||||
#339999
|
||||
#3399cc
|
||||
#3399ff
|
||||
#33cc00
|
||||
#33cc33
|
||||
#33cc66
|
||||
#33cc99
|
||||
#33cccc
|
||||
#33ccff
|
||||
#33ff00
|
||||
#33ff33
|
||||
#33ff66
|
||||
#33ff99
|
||||
#33ffcc
|
||||
#33ffff
|
||||
#660000
|
||||
#660033
|
||||
#660066
|
||||
#660099
|
||||
#6600cc
|
||||
#6600ff
|
||||
#663300
|
||||
#663333
|
||||
#663366
|
||||
#663399
|
||||
#6633cc
|
||||
#6633ff
|
||||
#666600
|
||||
#666633
|
||||
#666666
|
||||
#666699
|
||||
#6666cc
|
||||
#6666ff
|
||||
#669900
|
||||
#669933
|
||||
#669966
|
||||
#669999
|
||||
#6699cc
|
||||
#6699ff
|
||||
#66cc00
|
||||
#66cc33
|
||||
#66cc66
|
||||
#66cc99
|
||||
#66cccc
|
||||
#66ccff
|
||||
#66ff00
|
||||
#66ff33
|
||||
#66ff66
|
||||
#66ff99
|
||||
#66ffcc
|
||||
#66ffff
|
||||
#990000
|
||||
#990033
|
||||
#990066
|
||||
#990099
|
||||
#9900cc
|
||||
#9900ff
|
||||
#993300
|
||||
#993333
|
||||
#993366
|
||||
#993399
|
||||
#9933cc
|
||||
#9933ff
|
||||
#996600
|
||||
#996633
|
||||
#996666
|
||||
#996699
|
||||
#9966cc
|
||||
#9966ff
|
||||
#999900
|
||||
#999933
|
||||
#999966
|
||||
#999999
|
||||
#9999cc
|
||||
#9999ff
|
||||
#99cc00
|
||||
#99cc33
|
||||
#99cc66
|
||||
#99cc99
|
||||
#99cccc
|
||||
#99ccff
|
||||
#99ff00
|
||||
#99ff33
|
||||
#99ff66
|
||||
#99ff99
|
||||
#99ffcc
|
||||
#99ffff
|
||||
#cc0000
|
||||
#cc0033
|
||||
#cc0066
|
||||
#cc0099
|
||||
#cc00cc
|
||||
#cc00ff
|
||||
#cc3300
|
||||
#cc3333
|
||||
#cc3366
|
||||
#cc3399
|
||||
#cc33cc
|
||||
#cc33ff
|
||||
#cc6600
|
||||
#cc6633
|
||||
#cc6666
|
||||
#cc6699
|
||||
#cc66cc
|
||||
#cc66ff
|
||||
#cc9900
|
||||
#cc9933
|
||||
#cc9966
|
||||
#cc9999
|
||||
#cc99cc
|
||||
#cc99ff
|
||||
#cccc00
|
||||
#cccc33
|
||||
#cccc66
|
||||
#cccc99
|
||||
#cccccc
|
||||
#ccccff
|
||||
#ccff00
|
||||
#ccff33
|
||||
#ccff66
|
||||
#ccff99
|
||||
#ccffcc
|
||||
#ccffff
|
||||
#ff0000
|
||||
#ff0033
|
||||
#ff0066
|
||||
#ff0099
|
||||
#ff00cc
|
||||
#ff00ff
|
||||
#ff3300
|
||||
#ff3333
|
||||
#ff3366
|
||||
#ff3399
|
||||
#ff33cc
|
||||
#ff33ff
|
||||
#ff6600
|
||||
#ff6633
|
||||
#ff6666
|
||||
#ff6699
|
||||
#ff66cc
|
||||
#ff66ff
|
||||
#ff9900
|
||||
#ff9933
|
||||
#ff9966
|
||||
#ff9999
|
||||
#ff99cc
|
||||
#ff99ff
|
||||
#ffcc00
|
||||
#ffcc33
|
||||
#ffcc66
|
||||
#ffcc99
|
||||
#ffcccc
|
||||
#ffccff
|
||||
#ffff00
|
||||
#ffff33
|
||||
#ffff66
|
||||
#ffff99
|
||||
#ffffcc
|
||||
#ffffff
|
||||
@@ -0,0 +1,350 @@
|
||||
term.setGraphicsMode(2)
|
||||
local w,h = term.getSize(2)
|
||||
local fb={}
|
||||
for i=1, h do
|
||||
fb[i]={}
|
||||
for x=1, w do
|
||||
fb[i][x]=0
|
||||
end
|
||||
end
|
||||
|
||||
local function setPixel(x,y,c)
|
||||
--local old=fb[y]
|
||||
--fb[y]=string.sub(old,1,x-1)..string.char(c)..string.sub(old,x+1)
|
||||
fb[y][x]=c
|
||||
end
|
||||
|
||||
local function setPixels(x,y,frame)
|
||||
local w,h = #fb[1], #fb
|
||||
for i=1, #frame do
|
||||
for j=1, #frame[i] do
|
||||
fb[y+i-1][x+j-1]=frame[i][j]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function getPixel(x,y)
|
||||
return fb[y][x]
|
||||
end
|
||||
|
||||
local function getPixels(x,y,w,h)
|
||||
local ret={}
|
||||
for i=y, y+h do
|
||||
ret[#ret+1] = {table.unpack(fb[i], x, x+w)}
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
local colors = {
|
||||
[0]=0x000000,
|
||||
0x0b0b0b,
|
||||
0x222222,
|
||||
0x444444,
|
||||
0x555555,
|
||||
0x777777,
|
||||
0x888888,
|
||||
0xaaaaaa,
|
||||
0xbbbbbb,
|
||||
0xdddddd,
|
||||
0xeeeeee,
|
||||
0x00000b,
|
||||
0x000022,
|
||||
0x000044,
|
||||
0x000055,
|
||||
0x000077,
|
||||
0x000088,
|
||||
0x0000aa,
|
||||
0x0000bb,
|
||||
0x0000dd,
|
||||
0x0000ee,
|
||||
0x000b00,
|
||||
0x002200,
|
||||
0x004400,
|
||||
0x005500,
|
||||
0x007700,
|
||||
0x008800,
|
||||
0x00aa00,
|
||||
0x00bb00,
|
||||
0x00dd00,
|
||||
0x00ee00,
|
||||
0x0b0000,
|
||||
0x220000,
|
||||
0x440000,
|
||||
0x550000,
|
||||
0x770000,
|
||||
0x880000,
|
||||
0xaa0000,
|
||||
0xbb0000,
|
||||
0xdd0000,
|
||||
0xee0000,
|
||||
0x000033,
|
||||
0x000066,
|
||||
0x000099,
|
||||
0x0000cc,
|
||||
0x0000ff,
|
||||
0x003300,
|
||||
0x003333,
|
||||
0x003366,
|
||||
0x003399,
|
||||
0x0033cc,
|
||||
0x0033ff,
|
||||
0x006600,
|
||||
0x006633,
|
||||
0x006666,
|
||||
0x006699,
|
||||
0x0066cc,
|
||||
0x0066ff,
|
||||
0x009900,
|
||||
0x009933,
|
||||
0x009966,
|
||||
0x009999,
|
||||
0x0099cc,
|
||||
0x0099ff,
|
||||
0x00cc00,
|
||||
0x00cc33,
|
||||
0x00cc66,
|
||||
0x00cc99,
|
||||
0x00cccc,
|
||||
0x00ccff,
|
||||
0x00ff00,
|
||||
0x00ff33,
|
||||
0x00ff66,
|
||||
0x00ff99,
|
||||
0x00ffcc,
|
||||
0x00ffff,
|
||||
0x330000,
|
||||
0x330033,
|
||||
0x330066,
|
||||
0x330099,
|
||||
0x3300cc,
|
||||
0x3300ff,
|
||||
0x333300,
|
||||
0x333333,
|
||||
0x333366,
|
||||
0x333399,
|
||||
0x3333cc,
|
||||
0x3333ff,
|
||||
0x336600,
|
||||
0x336633,
|
||||
0x336666,
|
||||
0x336699,
|
||||
0x3366cc,
|
||||
0x3366ff,
|
||||
0x339900,
|
||||
0x339933,
|
||||
0x339966,
|
||||
0x339999,
|
||||
0x3399cc,
|
||||
0x3399ff,
|
||||
0x33cc00,
|
||||
0x33cc33,
|
||||
0x33cc66,
|
||||
0x33cc99,
|
||||
0x33cccc,
|
||||
0x33ccff,
|
||||
0x33ff00,
|
||||
0x33ff33,
|
||||
0x33ff66,
|
||||
0x33ff99,
|
||||
0x33ffcc,
|
||||
0x33ffff,
|
||||
0x660000,
|
||||
0x660033,
|
||||
0x660066,
|
||||
0x660099,
|
||||
0x6600cc,
|
||||
0x6600ff,
|
||||
0x663300,
|
||||
0x663333,
|
||||
0x663366,
|
||||
0x663399,
|
||||
0x6633cc,
|
||||
0x6633ff,
|
||||
0x666600,
|
||||
0x666633,
|
||||
0x666666,
|
||||
0x666699,
|
||||
0x6666cc,
|
||||
0x6666ff,
|
||||
0x669900,
|
||||
0x669933,
|
||||
0x669966,
|
||||
0x669999,
|
||||
0x6699cc,
|
||||
0x6699ff,
|
||||
0x66cc00,
|
||||
0x66cc33,
|
||||
0x66cc66,
|
||||
0x66cc99,
|
||||
0x66cccc,
|
||||
0x66ccff,
|
||||
0x66ff00,
|
||||
0x66ff33,
|
||||
0x66ff66,
|
||||
0x66ff99,
|
||||
0x66ffcc,
|
||||
0x66ffff,
|
||||
0x990000,
|
||||
0x990033,
|
||||
0x990066,
|
||||
0x990099,
|
||||
0x9900cc,
|
||||
0x9900ff,
|
||||
0x993300,
|
||||
0x993333,
|
||||
0x993366,
|
||||
0x993399,
|
||||
0x9933cc,
|
||||
0x9933ff,
|
||||
0x996600,
|
||||
0x996633,
|
||||
0x996666,
|
||||
0x996699,
|
||||
0x9966cc,
|
||||
0x9966ff,
|
||||
0x999900,
|
||||
0x999933,
|
||||
0x999966,
|
||||
0x999999,
|
||||
0x9999cc,
|
||||
0x9999ff,
|
||||
0x99cc00,
|
||||
0x99cc33,
|
||||
0x99cc66,
|
||||
0x99cc99,
|
||||
0x99cccc,
|
||||
0x99ccff,
|
||||
0x99ff00,
|
||||
0x99ff33,
|
||||
0x99ff66,
|
||||
0x99ff99,
|
||||
0x99ffcc,
|
||||
0x99ffff,
|
||||
0xcc0000,
|
||||
0xcc0033,
|
||||
0xcc0066,
|
||||
0xcc0099,
|
||||
0xcc00cc,
|
||||
0xcc00ff,
|
||||
0xcc3300,
|
||||
0xcc3333,
|
||||
0xcc3366,
|
||||
0xcc3399,
|
||||
0xcc33cc,
|
||||
0xcc33ff,
|
||||
0xcc6600,
|
||||
0xcc6633,
|
||||
0xcc6666,
|
||||
0xcc6699,
|
||||
0xcc66cc,
|
||||
0xcc66ff,
|
||||
0xcc9900,
|
||||
0xcc9933,
|
||||
0xcc9966,
|
||||
0xcc9999,
|
||||
0xcc99cc,
|
||||
0xcc99ff,
|
||||
0xcccc00,
|
||||
0xcccc33,
|
||||
0xcccc66,
|
||||
0xcccc99,
|
||||
0xcccccc,
|
||||
0xccccff,
|
||||
0xccff00,
|
||||
0xccff33,
|
||||
0xccff66,
|
||||
0xccff99,
|
||||
0xccffcc,
|
||||
0xccffff,
|
||||
0xff0000,
|
||||
0xff0033,
|
||||
0xff0066,
|
||||
0xff0099,
|
||||
0xff00cc,
|
||||
0xff00ff,
|
||||
0xff3300,
|
||||
0xff3333,
|
||||
0xff3366,
|
||||
0xff3399,
|
||||
0xff33cc,
|
||||
0xff33ff,
|
||||
0xff6600,
|
||||
0xff6633,
|
||||
0xff6666,
|
||||
0xff6699,
|
||||
0xff66cc,
|
||||
0xff66ff,
|
||||
0xff9900,
|
||||
0xff9933,
|
||||
0xff9966,
|
||||
0xff9999,
|
||||
0xff99cc,
|
||||
0xff99ff,
|
||||
0xffcc00,
|
||||
0xffcc33,
|
||||
0xffcc66,
|
||||
0xffcc99,
|
||||
0xffcccc,
|
||||
0xffccff,
|
||||
0xffff00,
|
||||
0xffff33,
|
||||
0xffff66,
|
||||
0xffff99,
|
||||
0xffffcc,
|
||||
0xffffff,
|
||||
}
|
||||
|
||||
for i=0,255 do
|
||||
term.setPaletteColor(i,colors[i])
|
||||
end
|
||||
term.drawPixels(0,0,fb)
|
||||
|
||||
for i=0,255 do
|
||||
for y=1+i, h-i do
|
||||
for x=1+i, w-i do
|
||||
setPixel(x,y,i)
|
||||
end
|
||||
end
|
||||
term.drawPixels(1,1,fb)
|
||||
os.queueEvent("nosleep")
|
||||
os.pullEvent()
|
||||
end
|
||||
|
||||
for i=1, 1000 do
|
||||
pcall(function()
|
||||
setPixels(math.random(1,w),math.random(1,h),getPixels(math.random(1,w),math.random(1,h),math.random(1,w),math.random(1,h)))
|
||||
end)
|
||||
term.drawPixels(1,1,fb)
|
||||
os.queueEvent("nosleep")
|
||||
os.pullEvent()
|
||||
end
|
||||
setPixels(1,1,getPixels(w-50,h-50,50,50))
|
||||
term.drawPixels(0,0,fb)
|
||||
|
||||
local i=0
|
||||
for x=1, 16*4, 4 do
|
||||
for y=1, 16*4, 4 do
|
||||
setPixel(x,y,i)
|
||||
setPixel(x+1,y,i)
|
||||
setPixel(x+2,y,i)
|
||||
setPixel(x+3,y,i)
|
||||
setPixel(x,y+1,i)
|
||||
setPixel(x+1,y+1,i)
|
||||
setPixel(x+2,y+1,i)
|
||||
setPixel(x+3,y+1,i)
|
||||
setPixel(x,y+2,i)
|
||||
setPixel(x+1,y+2,i)
|
||||
setPixel(x+2,y+2,i)
|
||||
setPixel(x+3,y+2,i)
|
||||
setPixel(x,y+3,i)
|
||||
setPixel(x+1,y+3,i)
|
||||
setPixel(x+2,y+3,i)
|
||||
setPixel(x+3,y+3,i)
|
||||
i=i+1
|
||||
end
|
||||
end
|
||||
term.drawPixels(0,0,fb)
|
||||
|
||||
sleep(5)
|
||||
term.setGraphicsMode(false)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
Reference in New Issue
Block a user