Posted 12 January 2017 - 03:18 AM
Hi,
I was recently working on a OS called CPOS, and the menu wasn't working.
Here is my code:
Pastebin code:
I need help quick!
I was recently working on a OS called CPOS, and the menu wasn't working.
Here is my code:
Source Code
term.setCursorPos(1,1)
term.setBackgroundColor(colors.black)
term.clear()
if not term.isColor() then
print("Requires advanced compter!")
return
end
version = "b0.1"
versionr = "Open beta 0.1"
dbg = "/cpos_tmp/desktopbg"
local steel_fr = [[
-- Steel Framework v1.0
-- 2017 xcrafter_40
local function fgbg(fg,bg)
term.setTextColor(fg)
term.setBackgroundColor(bg)
end
function writeText(txt,fg,bg)
fgbg(fg,bg)
term.write(txt)
end
function writeAt(txt,fg,bg,x,y)
term.setCursorPos(x,y)
fgbg(fg,bg)
term.write(txt)
end
function goto(x,y)
term.setCursorPos(x,y)
end
function bg(bg)
term.setBackgroundColor(bg)
end
function fg(fg)
term.setTextColor(fg)
end
function setAll(fg,bg,x,y)
fgbg(fg,bg)
term.setTextColor(x,y)
end
function resetColors()
fgbg(1,32768)
end
function resetPos()
term.setCursorPos(1,1)
end
function resetAll()
fgbg(1,32768)
term.setCursorPos(1,1)
end
function clear()
term.clear()
end
function clearLine()
term.clearLine()
end
function resetClear()
fgbg(1,32768)
term.setCursorPos(1,1)
term.clear()
end
function fillBg(bg)
term.setCursorPos(1,1)
term.setBackgroundColor(bg)
term.clear()
end
function fillLine(y,bg)
term.setCursorPos(1,y)
term.setBackgroundColor(bg)
term.clearLine()
end
function image(x,y,image)
paintutils.drawImage(paintutils.loadImage(image),x,y)
resetAll()
end
function writeD(txt)
term.write(txt)
end
function clickedAt(x1,y1,x2,y2)
local event, AA, AB, AC = os.pullEventRaw()
if event == "mouse_click" and AA == 1 and AB >= x1 and AB <= x2 and AC >= y1 and AC <= y2 then
return true
else
return false
end
end
]]
local desktop = [[
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
888008880777077700000000000000000000000000000000000
800008080707070000000000000000000000000000000000000
800008880707077700000000000000000000000000000000000
800008000707000700000000000000000000000000000000000
888008000777077700000000000000000000000000000000000
]]
local function unpackfile(str,file)
shell.setDir("")
fs.makeDir("cpos_tmp")
x = fs.open("cpos_tmp/" .. file,"w")
x.write(str)
x.close()
end
unpackfile(steel_fr,"steel")
os.loadAPI("/cpos_tmp/steel")
if not steel then
print("FATAL: STEEL API NOT LOADED!")
print("Contact xcrafter_40 for help!")
sleep(10)
exit()
end
steel.fillBg(colors.white)
steel.writeAt("CP",colors.gray,colors.white,1,1)
steel.writeAt("OS",colors.lightGray,colors.white,3,1)
steel.writeAt("Loading...",colors.red,colors.white,1,2)
unpackfile(desktop,"desktopbg")
sleep(2)
function drawDesktop()
screen = "desktop"
steel.resetClear()
steel.image(1,2,dbg)
steel.fillLine(1,colors.lightBlue)
steel.writeAt("#",colors.black,colors.lightBlue,1,1)
steel.goto(1,1)
end
run = true
screen = "desktop"
drawDesktop()
while run do
if os.pullEventRaw() == "terminate" then
steel.resetClear()
run = false
elseif screen == "desktop" then
if steel.clickedAt(1,1,1,1) then
steel.setAll(colors.black,colors.lightBlue,1,1)
steel.clearLine()
steel.writeD("Enter Filename: ")
pgname = read()
current = term.current()
a = window.create(term.current(),1,1,51,18)
a_coro = coroutine.create(loadfile(pgname))
term.redirect(a)
ok, err = coroutine.resume(a_coro)
if ok then
while coroutine.status(a_coro) ~= "dead" do
local event = {coroutine.yield()}
coroutine.resume(a_coro, unpack(event))
end
end
term.redirect(current)
drawDesktop()
end
end
end
os.unloadAPI("steel")
shell.setDir("")
fs.delete("cpos_tmp")
pastebin get 9rfeG3em cpos
Now when I click the # to open the run menu, it does nothingI need help quick!