~jordanreger/cc

4a4bb856f1df30567c49aecb8ca380a13daccf23 — Jordan Reger 3 months ago 096120e
feat(xOS): init
2 files changed, 66 insertions(+), 0 deletions(-)

A xOS/.x
A xOS/startup.lua
A xOS/.x => xOS/.x +54 -0
@@ 0,0 1,54 @@
local width, height = term.getSize()
local background_color = colors.lightGray

local window = window.create(term.current(), 1, 1, width, height)

function setup()
    window.setBackgroundColor(background_color)
    if (background_color ~= colors.black and background_color ~= colors.gray) then
        window.setTextColor(colors.black)
    else
        window.setTextColor(colors.white)
    end
    window.clear()
end

function render()
    window.setCursorPos(width / 2, height / 2)
    window.write("xx")
    window.setCursorPos(width / 2, height / 2 + 1)
    window.write("xx")
end

function on_click()
    local e, id, x, y = os.pullEvent("mouse_click")
    if e then
        if x == width / 2 and y == height / 2 then
            window.setCursorPos(1, 1)
            window.write("top left")
        elseif x == width / 2 + 1 and y == height / 2 then
            window.setCursorPos(1, 1)
            window.write("top right")
        elseif x == width / 2 and y == height / 2 + 1 then
            window.setCursorPos(1, 1)
            window.write("bottom left")
        elseif x == width / 2 + 1 and y == height / 2 + 1 then
            window.setCursorPos(1, 1)
            window.write("bottom right")
        else
            return
        end
    end
end

function main()
    setup()
    
    render()
    on_click()

    sleep(0.25)
    main()
end

main()
\ No newline at end of file

A xOS/startup.lua => xOS/startup.lua +12 -0
@@ 0,0 1,12 @@
rednet.open("back")

local width, height = term.getSize()

term.clear()
term.setCursorPos(width / 2 - 3, height / 2)
print("xOS v0.1")
sleep(1)
term.setCursorPos(width / 2 - 4, height / 2 + 1)
textutils.slowPrint("xxxxxxxxxx")
sleep(1)
shell.run(".x")
\ No newline at end of file