Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fs = require('filesystem')
- local multiplescreen = {}
- local curmon = '557'
- local mon = {}
- local image = require('image')
- local gpu = require('component').gpu
- local monitors = {'a05','b77','6d1','917','7a6','7b1','17a','10d','de3','a92','000','0fd','47e','ca0','0d7','b29','d35','b4b','b1e','902','4fc','4b8','31f','82a','05b','d6f','4ee','79b','518','c7a'}
- for i =1,6 do
- mon[i] = {}
- for s =1,5 do
- mon[i][s] = {}
- end
- end
- function get(address,CT)
- for c in require('component').list(CT,true) do
- if c:sub(1,address:len()) == address then
- return c
- end
- end
- end
- i = 0
- e = 0
- x = 0
- toend = {}
- s = 0
- while x < 126*6 do
- x = x + 126
- i = i + 1
- toend[i] = {}
- y = 0
- e = 0
- while y < 63 * 5 do
- y = y + 63
- e = e + 1
- s = s + 1
- toend[i][e] = monitors[s]
- end
- end
- local function set(idk)
- local symbol,_,bg = gpu.get(idk[1],idk[2])
- if bg == idk[3] then
- if symbol == idk[5] then
- print('skip')
- return
- end
- if symbol == ' ' then
- print('skip trans')
- return
- else
- print('skip trans any')
- gpu.setForeground(idk[4])
- gpu.set(idk[1],idk[2],idk[5])
- return
- end
- end
- gpu.setForeground(idk[4])
- gpu.setBackground(idk[3])
- local toend = gpu.set(idk[1],idk[2],idk[5])
- return toend
- end
- function multiplescreen.draw(x1,y1,path)
- if type(path) == 'string' then
- if fs.exists(path) then
- print('load')
- imagee = image.load(path)
- else
- return
- end
- else
- print('use')
- local imagee = path
- end
- local turn = 0
- local turnbool = false
- local w = imagee[1]
- local h = imagee[2]
- print(w,h)
- for x = 1,w do
- for y = 1,h do
- local bg,fg,_,symbol = image.get(imagee,x,y)
- local x = x + x1 - 1
- local y = y + y1 -1
- local xx = math.ceil(x / 126)
- local yy = math.ceil(y / 63)
- local localX = x - (xx - 1) * 126
- local localY = y - (yy - 1) * 63
- print('pixel')
- if xx > 6 then
- print(xx,yy,w,h,x1,y1,x,y)
- end
- table.insert(mon[xx][yy],{localX,localY,bg,fg,symbol})
- end
- end
- print('draw')
- for x = 1,6 do
- for y = 1,5 do
- if mon[x][y] ~= {} then
- gpu.bind(get(toend[x][y]),false)
- gpu.setDepth(8)
- gpu.setResolution(126,63)
- for i=1,#mon[x][y] do
- set(mon[x][y][i])
- end
- end end
- end
- gpu.bind(get('a73'))
- end
- return multiplescreen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement