Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x,y = term.getSize()
- local programName = "new"
- local selectedWorkspaceObject = "Game"
- local workspace = {
- ["Game"] = {
- ["Folder"] = true,
- },
- }
- local dahObjawcts = {
- [2] = "Game",
- }
- function iClicked5( posX, posY )
- if posX > x-15 then
- if dahObjawcts[posY] then
- return dahObjawcts[posY]
- end
- end
- return false
- end
- local scroll = 1
- local nMenuItem = 1
- local tArgs = { ... }
- if tArgs[1] then
- programName = tArgs
- end
- local function cPrint(text)
- x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- write(text.. "\n")
- end
- term.clear()
- function addObject( path, name, isFolder )
- path[name] = {
- ["Folder"] = isFolder,
- }
- end
- function renderExplorer()
- dahObjawcts = {}
- dahObjawcts[2] = "Game"
- term.setCursorPos(x-10, 1)
- write("Explorer")
- local i = 1
- function list( path, between )
- for k,v in pairs( path ) do
- if k ~= "Folder" then
- term.setCursorPos(x-15, 1+i)
- if selectedWorkspaceObject == (between.. k) then
- term.setBackgroundColour( colors.lime )
- else
- term.setBackgroundColour( colors.lightGray )
- end
- write( " " )
- term.setCursorPos(x-15, 1+i)
- write( between.. k )
- dahObjawcts[1+i] = between.. k
- i = i+1
- if path[k]["Folder"] then
- list( path[k], between.. "-- " )
- end
- end
- end
- end
- list( workspace, "" )
- term.setBackgroundColour( colors.lightBlue )
- for i=2,y do
- if i == y then
- term.setBackgroundColour( colors.gray )
- for ia=x-15,x do
- term.setCursorPos(ia,i)
- write(" ")
- end
- else
- term.setCursorPos(x, i)
- write(" ")
- end
- end
- term.setCursorPos(x-10, y)
- write("Presets")
- term.setCursorPos(x, 1+scroll)
- term.setBackgroundColour( colors.blue )
- write("=")
- end
- function renderMenu()
- term.setCursorPos(1,2)
- term.setBackgroundColour( colors.gray )
- if nMenuItem == 1 then
- write("Insert -[Player]Object Folder ")
- elseif nMenuItem == 2 then
- write("Insert - Player[Object]Folder ")
- elseif nMenuItem == 3 then
- write("Insert - Player Object[Folder]")
- end
- end
- function drawWorkspace()
- for i=1,x do
- for z=1,y do
- paintutils.drawPixel( i, z, colors.white )
- end
- paintutils.drawPixel( i, 1, colors.lightGray )
- paintutils.drawPixel( i, 2, colors.gray )
- paintutils.drawPixel( i, y, colors.lightGray )
- for z=1,y do
- for iz=x-15,x do
- paintutils.drawPixel( iz, z, colors.lightGray )
- end
- paintutils.drawPixel( x-16, z, colors.gray )
- end
- for iz=x-15,x do
- paintutils.drawPixel( iz, 1, colors.gray )
- end
- end
- term.setBackgroundColour( colors.lightGray )
- term.setTextColour( colors.black )
- term.setCursorPos(1,1)
- write("GameSketch v1.0 - " ..programName)
- term.setCursorPos(1,y)
- write( "Editing" )
- renderMenu()
- renderExplorer()
- end
- addObject( workspace["Game"], "Object_1", false)
- drawWorkspace()
- while true do
- local event, key, keyX, keyY = os.pullEvent()
- if event == "key" then
- if key == keys.left then
- if nMenuItem ~= 1 then
- nMenuItem = nMenuItem -1
- renderMenu()
- end
- elseif key == keys.right then
- if nMenuItem ~= 3 then
- nMenuItem = nMenuItem +1
- renderMenu()
- end
- elseif key == keys.enter then
- if nMenuItem == 1 then
- local name = "Player"
- local nameType = 1
- while workspace["Game"][name] do
- name = "Player_" ..nameType
- nameType = nameType +1
- end
- addObject( workspace["Game"], name, false )
- elseif nMenuItem == 2 then
- local name = "Object"
- local nameType = 1
- while workspace["Game"][name] do
- name = "Object_" ..nameType
- nameType = nameType +1
- end
- addObject( workspace["Game"], name, false )
- elseif nMenuItem == 3 then
- local name = "Folder"
- local nameType = 1
- while workspace["Game"][name] do
- name = "Folder_" ..nameType
- nameType = nameType +1
- end
- addObject( workspace["Game"], name, true )
- end
- renderExplorer()
- end
- elseif event == "mouse_click" then
- if key == 1 then
- if iClicked5( keyX, keyY ) then
- selectedWorkspaceObject = iClicked5( keyX, keyY )
- renderExplorer()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment