Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function version() return "cwu 1.0 - by ntnick" end
- function core_resColors()
- term.setTextColour(colours.white)
- term.setBackgroundColour(colours.black)
- end
- function screenH() local x, y = term.getSize() return {x,y} end
- function object_textButton(x,y,tCol,bCol,text)
- term.setCursorPos(x,y)
- term.setTextColour(tCol)
- term.setBackgroundColour(bCol)
- term.write(text)
- term.setTextColour(colours.white)
- term.setBackgroundColour(colours.black)
- end
- function object_button(x,y,buttonCol,buttonWidth)
- term.setCursorPos(x,y)
- term.setTextColour(buttonCol)
- term.setBackgroundColour(buttonCol)
- local cwu_bin_objects_iTxt = ""
- for i=1, buttonWidth do
- cwu_bin_objects_iTxt = cwu_bin_objects_iTxt.."d"
- end
- term.write(cwu_bin_objects_iTxt)
- cwu_bin_objects_iTxt = nil
- term.setTextColour(colours.white)
- term.setBackgroundColour(colours.black)
- end
- function object_img(imgX,imgY,imgPath)
- if(fs.exists(imgPath) == false) then
- error("cwu-1.0: object_img: "..imgPath.." does not exist")
- end
- local cwu_bin_objects_o_imgPath = paintutils.loadImage(imgPath)
- paintutils.drawImage(cwu_bin_objects_o_imgPath,x,y)
- cwu_bin_objects_o_imgPath = nil
- end
- function object_textLabel(x,y,bCol,tCol,text)
- term.setTextColour(tCol)
- term.setBackgroundColour(bCol)
- term.setCursorPos(x,y)
- term.write(text)
- term.setTextColour(colours.white)
- term.setBackgroundColour(colours.black)
- end
- function object_animation(images,fps,animX,animY)
- for i=1, #images do
- local cwu_bin_objects_o_animationFrame = paintutils.loadImage(images[i])
- paintutils.drawImage(cwu_bin_objects_o_animationFrame,animX,animY)
- sleep(fps)
- cwu_bin_objects_o_animationFrame = nil
- end
- end
- function graphics_bColor(col)
- local cwu_bin_graphics_w,cwu_bin_graphics_h = term.getSize()
- term.setTextColour(col); term.setBackgroundColour(col)
- for i=1, cwu_bin_graphics_h do
- for j=1, cwu_bin_graphics_w do
- term.setCursorPos(i,j)
- term.write("o")
- end
- end
- cwu_bin_graphics_w = nil
- cwu_bin_graphics_h = nil
- term.setTextColour(colours.white)
- term.setBackgroundColour(colours.black)
- end
- function mtl_newWindow(posX,posY,sizeX,sizeY,color)
- local cwu_bin_mtl_window = window.create(posX,posY,sizeX,sizeY)
- cwu_bin_mtl_window.setBackgroundColour(color)
- cwu_bin_mtl_window.clear()
- return cwu_bin_mtl_window
- end
- function object_clock(x,y,bcol,tcol)
- local cwu_bin_objects_clock_time = os.time()
- term.setTextColour(tcol)
- term.setBackgroundColour(bcol)
- term.setCursorPos(x,y)
- term.write(cwu_bin_objects_clock_time)
- term.setTextColour(colours.white)
- term.setBackgroundColour(colours.black)
- cwu_bin_objects_clock_time = nil
- end
- function object_textField(x,y,len,bCol,tCol)
- term.setCursorPos(x,y)
- term.setBackgroundColour(bCol)
- term.setTextColour(tCol)
- local cwu_bin_objects_tf_keys = 0
- local cwu_bin_objects_tf_val = x
- local cwu_bin_objects_tf_cur = x
- local cwu_bin_typedText = ""
- for i=1, len do
- term.setCursorPos(i,y)
- term.setTextColour(bCol)
- term.write("i")
- end
- term.setTextColour(tCol)
- while true do
- -- os.pullEventRaw isn't needed here..
- local char, e = os.pullEvent("char")
- term.setCursorPos(cwu_bin_objects_tf_cur,y)
- cwu_bin_objects_tf_cur = cwu_bin_objects_tf_cur + 1
- cwu_bin_objects_tf_keys = cwu_bin_objects_tf_keys + 1
- term.write(e)
- cwu_bin_typedText = cwu_bin_typedText..e
- if(cwu_bin_objects_tf_keys == len) then
- return cwu_bin_typedText
- end
- end
- end
- -- window utilities
- function mtl_appendText(window,text,tCol)
- window.setTextColour(tCol)
- window.write(text)
- end
Add Comment
Please, Sign In to add comment