mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-31 19:29:11 +00:00
Added clean exit
This commit is contained in:
parent
50e36ff3c8
commit
445f7895c7
@ -12,6 +12,14 @@ local windowHeight = scr_y
|
|||||||
-- program that will start up for workspaces
|
-- program that will start up for workspaces
|
||||||
local defaultProgram = "rom/programs/shell.lua"
|
local defaultProgram = "rom/programs/shell.lua"
|
||||||
|
|
||||||
|
if _G.currentlyRunningWorkspace then
|
||||||
|
print("Workspace is already running.")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
_G.currentlyRunningWorkspace = true
|
||||||
|
end
|
||||||
|
local isRunning = true
|
||||||
|
|
||||||
-- start up lddterm
|
-- start up lddterm
|
||||||
local lddterm = {}
|
local lddterm = {}
|
||||||
lddterm.alwaysRender = false -- renders after any and all screen-changing functions.
|
lddterm.alwaysRender = false -- renders after any and all screen-changing functions.
|
||||||
@ -545,9 +553,15 @@ local newInstance = function(x, y, program, initialStart)
|
|||||||
term.setCursorPos(scr_x / 2 - #text / 2, scr_y / 2)
|
term.setCursorPos(scr_x / 2 - #text / 2, scr_y / 2)
|
||||||
term.write(text)
|
term.write(text)
|
||||||
repeat
|
repeat
|
||||||
evt = {os.pullEvent("key")}
|
evt = {os.pullEventRaw()}
|
||||||
until evt[2] == keys.space
|
until (evt[1] == "key" and evt[2] == keys.space) or evt[1] == "terminate"
|
||||||
sleep(0)
|
sleep(0)
|
||||||
|
|
||||||
|
if evt[1] == "terminate" then
|
||||||
|
isRunning = false
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
term.setCursorPos(1,1)
|
term.setCursorPos(1,1)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorBlink(true)
|
term.setCursorBlink(true)
|
||||||
@ -632,7 +646,7 @@ end
|
|||||||
local main = function()
|
local main = function()
|
||||||
local enteringCommand
|
local enteringCommand
|
||||||
local justStarted = true
|
local justStarted = true
|
||||||
while true do
|
while isRunning do
|
||||||
local evt = {os.pullEventRaw()}
|
local evt = {os.pullEventRaw()}
|
||||||
enteringCommand = false
|
enteringCommand = false
|
||||||
if evt[1] == "key" then
|
if evt[1] == "key" then
|
||||||
@ -702,3 +716,9 @@ local main = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
_G.currentlyRunningWorkspace = false
|
||||||
|
|
||||||
|
term.clear()
|
||||||
|
term.setCursorPos(1,1)
|
||||||
|
print("Thanks for using Workspace!")
|
||||||
|
Loading…
Reference in New Issue
Block a user