Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Vars-------------------------------------------------------------------
- local w,h = term.getSize()
- local rng = true
- --buffer
- local buffer = buf.createBuffer(w,h)
- --Graphs
- local Graphs = {}
- local Cvertex = {math.floor(w/2),math.floor(h/2)}
- ----------------------------------------------------------------------
- local function setupGraph(Xs,Ys,Vx,Vy,Scale) -- X screen, Y screen, X vertex, Y vertex, Bc color, Scale = Add later
- local Xs = Xs or w
- local Ys = Ys or h
- local Vx = Vx or math.floor(w/2)
- local Vy = Vy or math.floor(h/2)
- table.insert(Graphs,{})
- local n = #Graphs
- for y=1, Ys do
- table.insert(buffer[n],{})
- for x=1, Xs do
- local i = {1,32768," "}
- table.insert(buffer[n][Ys],i)
- end
- end
- return n
- end
- local function drawCrass(Vx,Vy,Bc,Cc) --vertex
- local Vx = Vx or math.floor(w/2)
- local Vy = Vy or math.floor(h/2)
- local Bc = Bc or colors.white
- local CC = Cc or colors.blue
- buf.clsB(buffer,Bc)
- for y=1,h,2 do
- if 0 < Vx and Vx <= 52 then
- buf.drawPixel(buffer,Vx,y,Cc)
- end
- end
- for x=1,w,2 do
- if 0 < Vy and Vy <= 19 then
- buf.drawPixel(buffer,x,Vy,Cc)
- end
- end
- end
- local function main()
- drawCrass()
- buf.drawBuffer(buffer)
- term.setTextColor(colors.black)
- while rng do
- local args = { os.pullEvent() }
- if args[1] == "terminate" then
- rng = false
- end
- end
- return true
- end
- local ok, err = pcall(main)
- if not ok then
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.black)
- write(err)
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement