Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bRunning = true
- local window_key = window.create(term.native(),4,4,10,10,true)
- local window_shell = window.create(term.native(),18,4,10,10,true)
- local function func1()
- shell.run("/rom/programs/shell")
- end
- local function func2()
- shell.run("/rom/programs/shell")
- end
- local activeWindow = window_key
- local cor1 = coroutine.create(func1)
- local cor2 = coroutine.create(func2)
- while true do
- local event = { os.pullEvent() }
- if event[1] == "mouse_click" then
- if event[3] >= 4 and event[3] <= 14 and event[4] >= 4 and event[4] <= 14 then
- activeWindow = window_key
- elseif event[3] >= 18 and event[3] <= 28 and event[4] >= 4 and event[4] <= 14 then
- activeWindow = window_shell
- end
- elseif event[1] == "key" then
- if event[2] == keys.space then
- local _x,_y,_w,_h = activeWindow.getPosition()
- activeWindow.reposition(_x+1,_y,_w,_h)
- term.clear()
- window_shell.redraw()
- window_key.redraw()
- end
- end
- term.redirect(activeWindow)
- activeWindow.redraw()
- if activeWindow == window_key then
- coroutine.resume(cor1,unpack(event))
- elseif activeWindow == window_shell then
- coroutine.resume(cor2,unpack(event))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement