Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- Main = {
- [ "frst_run.cc" ] = "term.setBackgroundColor(colors.gray)\
- term.clear()\
- function TextWel()\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.gray)\
- term.setCursorPos(16,6)\
- sleep(0.34)\
- print(\"We\")\
- sleep(0.34)\
- term.setCursorPos(18,6)\
- print(\"lco\")\
- sleep(0.34)\
- term.setCursorPos(21,6)\
- print(\"me\")\
- sleep(0.34)\
- term.setCursorPos(23,6)\
- print(\" to \")\
- sleep(0.34)\
- term.setCursorPos(27,6)\
- print(\"Lion\")\
- sleep(0.34)\
- term.setCursorPos(31,6)\
- print(\" O\")\
- sleep(0.34)\
- term.setCursorPos(33,6)\
- print(\"S \")\
- sleep(0.34)\
- term.setCursorPos(35,6)\
- print(\"X\")\
- term.setCursorPos(27,6)\
- term.setTextColor(colors.orange)\
- term.write(\"Lion OS X\")\
- end\
- function drawTab()\
- paintutils.drawLine(11,8,41,8,colors.lightGray)\
- paintutils.drawLine(11,9,41,9,colors.lightGray)\
- paintutils.drawLine(11,10,41,10,colors.lightGray)\
- term.setCursorPos(12,9)\
- term.setTextColor(colors.white)\
- term.write(\"Username: \")\
- username = read()\
- name = fs.open(\"System/Config/clog.cfg\",\"w\")\
- name.writeLine(username)\
- name.close()\
- paintutils.drawLine(12,9,36,9,colors.lightGray)\
- term.setCursorPos(12,9)\
- term.write(\"Password: \")\
- password = read()\
- paintutils.drawLine(12,9,36,9,colors.lightGray)\
- term.setCursorPos(11,9)\
- term.write(\"@Password: \")\
- password2 = read()\
- govno = true\
- function testPASSLOG()\
- --\
- if password2 == password then\
- op = fs.open(\"System/Config/user.cfg\",\"w\")\
- op.writeLine(\"OLD\")\
- op.close()\
- kek = fs.open(\"System/Config/pas.cfg\",\"w\")\
- kek.writeLine(password)\
- kek.close()\
- govno = false\
- elseif password2 ~= password then\
- paintutils.drawLine(12,9,36,9,colors.lightGray)\
- term.setTextColor(colors.red)\
- term.setCursorPos(12,10)\
- term.write(\"@Pass ~= Pass!\")\
- term.setCursorPos(11,9)\
- term.setTextColor(colors.white)\
- term.write(\"@Password: \")\
- password2 = read()\
- testPASSLOG()\
- end\
- --\
- end\
- end\
- TextWel()\
- drawTab()\
- while govno do\
- testPASSLOG()\
- end\
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- ",
- OSEL = "os.loadAPI(\"GUI\")\
- ---StartOs\
- term.clear()\
- os.pullEvent = os.pullEventRaw\
- poop = fs.open(\"System/Config/user.cfg\",\"r\")\
- pop = poop.readLine()\
- if pop == \"NEW\" then\
- term.clear()\
- shell.run(\"System/Main/frst_run.cc\")\
- end\
- ----\
- log = fs.open(\"System/Config/clog.cfg\",\"r\")\
- logr = log.readLine()\
- log.close()\
- pas = fs.open(\"System/Config/pas.cfg\",\"r\")\
- pasr = pas.readLine()\
- pas.close()\
- ---login--\
- function login()\
- term.clear()\
- local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
- paintutils.drawImage(load,1,1)\
- term.setTextColor(colors.black)\
- paintutils.drawFilledBox(15,5,37,8,colors.lightGray)\
- paintutils.drawFilledBox(16,6,36,7,colors.white)\
- term.setCursorPos(16,6)\
- local wileX = true\
- function passwordIn()\
- paintutils.drawLine(16,7,33,7,colors.white)\
- term.setCursorPos(16,6)\
- term.write(\" \")\
- term.setCursorPos(16,6)\
- term.write(\" Password:\")\
- local password = read(\"*\")\
- if password == pasr then\
- wileX = false\
- welcome()\
- else\
- term.setTextColor(colors.red)\
- paintutils.drawLine(16,7,33,7,colors.white)\
- term.setCursorPos(16,7)\
- term.write(\" Wrong password!\")\
- term.setCursorPos(23,6)\
- term.setTextColor(colors.black)\
- passwordIn()\
- end\
- ------\
- end\
- --\
- --\
- --\
- function inLog()\
- term.setTextColor(colors.black)\
- paintutils.drawLine(16,6,33,6,colors.white)\
- term.setCursorPos(16,6)\
- term.write(\" Login:\")\
- if read() == logr then\
- passwordIn()\
- else\
- paintutils.drawLine(16,7,33,7,colors.white)\
- term.setCursorPos(16,7)\
- term.setTextColor(colors.red)\
- term.write(\" Wrong login!\")\
- term.setTextColor(colors.black)\
- end\
- end\
- ----\
- --\
- --\
- function ENTER()\
- inLog()\
- end\
- while wileX do\
- ENTER()\
- end\
- end\
- ---\
- ---welcome--\
- function welcome()\
- term.clear()\
- local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
- paintutils.drawImage(load,1,1)\
- term.setTextColor(colors.red)\
- local i = 0\
- paintutils.drawPixel(23,9,colors.orange)\
- term.setCursorPos(23,9)\
- term.write(\"Welcome \")\
- term.setCursorPos(24,9)\
- term.setBackgroundColor(colors.gray)\
- term.write(\"e\")\
- term.setCursorPos(25,9)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"l\")\
- term.setCursorPos(28,9)\
- term.setBackgroundColor(colors.gray)\
- term.write(\"m\")\
- term.setCursorPos(29,9)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"e\")\
- sleep(0.2)\
- paintutils.drawPixel(20,11,colors.blue)\
- sleep(0.5)\
- paintutils.drawLine(21,11,26,11,colors.blue)\
- sleep(0.3)\
- paintutils.drawLine(27,11,30,11,colors.blue)\
- sleep(0.4)\
- paintutils.drawLine(30,11,32,11,colors.blue)\
- sleep(1)\
- ---\
- end\
- ---\
- function loadSys()\
- local load = paintutils.loadImage(\"System/Pictures/Icons/stus.plc\")\
- paintutils.drawImage(load,1,1)\
- paintutils.drawLine(20,11,32,11,colors.white)\
- term.setCursorPos(22,9)\
- term.setTextColor(colors.orange)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"Lion OS X\")\
- term.setTextColor(colors.black)\
- term.setCursorPos(40,19)\
- term.write(\"ZfelfProg CC\")\
- term.setCursorPos(1,19)\
- term.write(\"AlexZfelf CC\")\
- sleep(1)\
- paintutils.drawPixel(20,11,colors.blue)\
- sleep(1.2)\
- paintutils.drawLine(21,11,24,11,colors.blue)\
- sleep(1,3)\
- paintutils.drawLine(25,11,30,11,colors.blue)\
- sleep(1)\
- paintutils.drawLine(30,11,32,11,colors.blue)\
- sleep(1)\
- login()\
- end\
- ---\
- loadSys()\
- \
- -------\
- ---\
- ---background---color---as\
- \
- ---\
- -------\
- term.setBackgroundColor(colors.lightBlue)\
- term.clear()\
- term.setCursorPos(1,1)\
- -----\
- SelectBc = {\
- [1] = colors.lightBlue\
- }\
- ------osgui-----\
- function gui()\
- term.clear()\
- term.setBackgroundColor(SelectBc[1])\
- term.setCursorPos(1,1)\
- --------upbar----\
- function upbar()\
- paintutils.drawLine(1,1,44,1,colors.lightGray)\
- end\
- upbar()\
- ----iconW---\
- paintutils.drawPixel(1,1,colors.lightGray)\
- paintutils.drawPixel(2,1,colors.lightGray)\
- term.setCursorPos(1,1)\
- term.setTextColor(colors.white)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"OS\")\
- -----clock----\
- paintutils.drawLine(45,1,51,1,colors.blue)\
- end\
- ------timeclock----\
- function time()\
- local time = os.time()\
- local ftime = textutils.formatTime(time,false)\
- term.setTextColor(colors.white)\
- term.setBackgroundColor(colors.blue)\
- term.setCursorPos(44,1)\
- term.write(ftime)\
- end\
- function desktop()\
- folder = paintutils.loadImage(\"System/Pictures/Icons/folder.pic\")\
- program = paintutils.loadImage(\"System/Pictures/Icons/program.pic\")\
- file = paintutils.loadImage(\"System/Pictures/Icons/file.pic\")\
- paint = paintutils.loadImage(\"System/Pictures/Icons/paint.exe\")\
- paintutils.drawImage(folder,3,3) \
- paintutils.drawImage(paint,11,3)\
- end\
- function fileName()\
- naziF = 0\
- if naziF == 0 then\
- term.setCursorPos(3,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(SelectBc[1])\
- term.write(\"System\")\
- term.setCursorPos(11,8)\
- term.write(\" Paint\")\
- end\
- if naziF == 1 then\
- term.setCursorPos(3,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(SelectBc[1])\
- term.write(\"System\")\
- term.setCursorPos(11,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.red)\
- term.write(\"Pa\")\
- term.setBackgroundColor(colors.white)\
- term.write(\"int\")\
- end\
- end\
- function select()\
- sel = paintutils.loadImage(\"select.pic\")\
- end\
- menuHide = 0\
- folderHide = 0\
- function osmenu()\
- menu = paintutils.loadImage(\"System/Pictures/Icons/osMenu.cpic\")\
- event,button,x,y = os.pullEvent()\
- if event == \"mouse_click\" then\
- if menuHide == 0 and folderHide == 0 and button == 1 and x == 1 and y == 1 or menuHide == 0 and button == 1 and x == 2 and y == 1 then\
- paintutils.drawImage(menu,2,2)\
- term.setCursorPos(1,1)\
- term.setBackgroundColor(colors.blue)\
- term.write(\"OS\")\
- sleep(0.140)\
- ------button---options----\
- term.setCursorPos(3,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Options\")\
- paintutils.drawPixel(10,8,colors.lightGray)\
- term.setCursorPos(10,8)\
- term.write(\">\")\
- ------button---shutdown---\
- term.setCursorPos(3,9)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Reboot\")\
- paintutils.drawPixel(10,9,colors.lightGray)\
- term.setCursorPos(10,9)\
- term.write(\">\")\
- ------button---folder----\
- term.setCursorPos(3,7)\
- term.setBackgroundColor(colors.white)\
- term.write(\"My CC\")\
- paintutils.drawPixel(10,7,colors.lightGray)\
- term.setCursorPos(10,7)\
- term.write(\">\")\
- ------button---exit-------\
- term.setCursorPos(3,6)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Shell\")\
- paintutils.drawPixel(10,6,colors.lightGray)\
- term.setCursorPos(10,6)\
- term.write(\">\")\
- ------button---closebar---\
- term.setCursorPos(3,2)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Hide\")\
- paintutils.drawPixel(10,2,colors.yellow)\
- term.setCursorPos(10,2)\
- term.write(\">\")\
- term.setCursorPos(2,3)\
- term.setTextColor(colors.lightGray)\
- term.setBackgroundColor(colors.white)\
- term.write(\"---------\")\
- ------button---\
- menuHide = 1\
- end\
- end\
- end\
- winhide = 0\
- function mSettings()\
- if menuHide == 1 then\
- if button == 1 and x == 10 and y == 8 then\
- menuHide = 0\
- folderHide = 0\
- paintutils.drawPixel(10,8,colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(10,8)\
- term.write(\">\")\
- sleep(0.143)\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- time()\
- fileName()\
- function winOP()\
- window = paintutils.loadImage(\"System/Pictures/Win/win.plw\")\
- paintutils.drawImage(window,7,3)\
- -------textin---win--\
- term.setCursorPos(8,5)\
- term.setBackgroundColor(colors.white)\
- term.setTextColor(colors.black)\
- term.write(\" Background color: \")\
- paintutils.drawPixel(27,5,colors.green)\
- paintutils.drawPixel(28,5,colors.lightBlue)\
- paintutils.drawPixel(29,5,colors.red)\
- paintutils.drawPixel(30,5,colors.pink)\
- term.setCursorPos(8,7)\
- term.setBackgroundColor(colors.white)\
- term.write(\" Selected: \")\
- paintutils.drawPixel(19,7,SelectBc[1])\
- term.setCursorPos(8,9)\
- term.setBackgroundColor(colors.white)\
- term.write(\" Save & Exit\")\
- term.setCursorPos(21,9)\
- term.write(\">\")\
- end\
- winOP()\
- menuHide = 0\
- \
- \
- \
- \
- -----endtetx----\
- winhide = 1\
- elseif folderHide == 1 then\
- \
- end\
- end\
- end\
- \
- function txwin()\
- if menuHide == 0 and folderHide == 0 and event == \"mouse_click\" then\
- if winhide == 1 then\
- if button == 1 and x == 7 and y == 3 then\
- menuHide = 0\
- winhide = 0\
- time()\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- osmenu()\
- end\
- end\
- end\
- end\
- function shutdown()\
- if menuHide == 1 then\
- if button == 1 and x == 10 and y == 9 then\
- paintutils.drawPixel(10,9,colors.red)\
- term.setTextColor(colors.white)\
- term.setCursorPos(10,9)\
- term.write(\">\")\
- sleep(0.144)\
- os.reboot()\
- end\
- end\
- function func()\
- if menuHide == 1 then\
- if button == 1 and x == 10 and y == 7 then\
- paintutils.drawPixel(10,7,colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(10,7)\
- term.write(\">\")\
- end\
- \
- end\
- \
- end\
- \
- end\
- function OSDRAW()\
- mSettings()\
- osmenu()\
- txwin()\
- pickcolor()\
- shutdown()\
- func()\
- \
- end\
- OSWHILE = true\
- function exit()\
- if menuHide == 1 and button == 1 and x == 10 and y == 6 then\
- paintutils.drawPixel(10,6,colors.blue)\
- term.setCursorPos(10,6)\
- term.setTextColor(colors.white)\
- term.write(\">\")\
- sleep(0.143)\
- term.clear()\
- term.setBackgroundColor(colors.black)\
- term.setCursorPos(1,1)\
- term.setTextColor(colors.yellow)\
- term.clear()\
- term.write(\"LionSh 1.7\")\
- term.setCursorPos(1,2)\
- sleep(0.104)\
- OSWHILE = false\
- end\
- end\
- ----\
- function closebar()\
- if menuHide == 1 then\
- if folderHide == 0 and menuHide == 1 and button == 1 and x == 10 and y == 2 then\
- paintutils.drawPixel(10,2,colors.blue)\
- term.setCursorPos(10,2)\
- term.setTextColor(colors.white)\
- term.write(\">\")\
- sleep(0.144)\
- term.setCursorPos(1,1)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"OS\")\
- term.setBackgroundColor(SelectBc[1])\
- menuHide = 0\
- gui()\
- desktop()\
- fileName()\
- time()\
- osmenu()\
- elseif folderHide == 1 and button == 1 and x == 10 and y == 2 then\
- filD = paintutils.loadImage(\"System/Pictures/FolderIn/menuHide.pic\")\
- paintutils.drawImage(filD,2,2)\
- menuHide = 0\
- term.setCursorPos(6,3)\
- term.setBackgroundColor(colors.lightGray)\
- term.setTextColor(colors.black)\
- term.write(\"<>\")\
- term.setBackgroundColor(colors.gray)\
- term.setCursorPos(2,2)\
- term.setTextColor(colors.yellow)\
- term.write(\"0\")\
- term.setCursorPos(3,2)\
- term.setTextColor(colors.green)\
- term.write(\"0\")\
- elseif winhide == 1 and button == 1 and x == 10 and y == 2 then\
- menuHide = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- time()\
- osmenu()\
- paintutils.drawImage(window,7,3)\
- winOP()\
- end\
- end\
- end\
- \
- \
- \
- ----func---color----pick\
- function pickcolor()\
- local file = fs.open(\"color\",\"w\")\
- if winhide == 1 then\
- if button == 1 and x == 27 and y == 5 then\
- SelectBc[1] = colors.green\
- paintutils.drawPixel(19,7,SelectBc[1])\
- file.write(\"colors.green\")\
- elseif x == 28 and y == 5 then\
- SelectBc[1] = colors.lightBlue\
- paintutils.drawPixel(19,7,SelectBc[1])\
- file.write(\"colors.lightBlue\")\
- elseif x == 29 and y == 5 then\
- SelectBc[1] = colors.red\
- naziF = 1\
- paintutils.drawPixel(19,7,SelectBc[1])\
- nazi = paintutils.loadImage(\"System/wallpapers/grammarnazi.fuck\")\
- paintutils.drawImage(nazi,1,2)\
- fileName()\
- desktop()\
- file.write(\"colors.red\")\
- elseif x == 30 and y == 5 then\
- SelectBc[1] = colors.pink\
- paintutils.drawPixel(19,7,SelectBc[1])\
- file.write(\"colors.pink\")\
- elseif x == 21 and y == 9 then\
- file.close()\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- fileName()\
- desktop()\
- time()\
- end\
- end\
- end\
- ----\
- --\
- contextdraw = 0\
- function context_draw()\
- contextr = paintutils.loadImage(\"System/Pictures/Menus/Context.pic\")\
- paintutils.drawImage(contextr,x,y)\
- term.setCursorPos(x+1,y)\
- term.setBackgroundColor(colors.white)\
- term.setTextColor(colors.black)\
- term.write(\"Open\")\
- term.setCursorPos(x+7,y)\
- term.setBackgroundColor(colors.yellow)\
- term.write(\">\")\
- term.setCursorPos(x,y+1)\
- term.setTextColor(colors.lightGray)\
- term.setBackgroundColor(colors.white)\
- term.write(\"--------\")\
- term.setCursorPos(x+1,y+6)\
- term.setTextColor(colors.black)\
- term.write(\"Info\")\
- term.setCursorPos(x+7,y+6)\
- term.setBackgroundColor(colors.yellow)\
- term.write(\">\")\
- contextdraw = 1\
- end\
- ---context-----touch---\
- function context_touch()\
- if contextdraw == 1 and folderHide == 0 and y ~= 1 then\
- if button == 1 and folderHide == 0 then\
- contextdraw = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- time()\
- menuHide = 0\
- end\
- end\
- end\
- ----\
- function context_drawLeft()\
- contextl = paintutils.loadImage(\"System/Pictures/Menus/ContexLeft.pic\")\
- paintutils.drawImage(contextl,43,y)\
- end\
- --\
- function context_call()\
- local math = 45\
- local xx = x\
- if y ~= 1 and x ~= 45 or x ~= 46 or x ~= 47 or x ~= 48 or x ~= 49 or x ~= 50 or x ~= 51 then\
- if button == 2 and contextdraw == 0 then\
- context_draw()\
- contextdraw = 1\
- end\
- elseif xx > math then\
- context_drawLeft()\
- contextdraw = 1\
- end\
- end\
- ----\
- --\
- function folderin_draw()\
- folderin = paintutils.loadImage(\"System/Pictures/FolderIn/oldf.plw\")\
- paintutils.drawImage(folderin,1,2)\
- end\
- --\
- ----\
- function paint_app()\
- if button == 1 then\
- if x == 11 and y == 3 or x == 12 and y == 3 or x == 13 and y == 3 or x == 14 and y == 3 or x == 15 and y == 3 or x == 16 and y == 3 or x == 11 and y == 4 or x == 12 and y == 4 or x == 14 and y == 4 or x == 14 and y == 4 or x == 15 and y == 4 or x == 16 and y == 4 or x == 11 and y == 5 or x == 12 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 16 and y == 5 or x == 11 and y == 6 or x == 12 and y == 6 or x == 16 and y == 6 or x == 16 and y == 6 or x == 16 then\
- selC = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
- paintutils.drawImage(selC,10,3)\
- paintutils.drawImage(paint,11,3)\
- term.setBackgroundColor(colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(11,8)\
- term.write(\" Paint\")\
- sleep(0.155)\
- shell.run(\"System/Programms/paint.cc\")\
- end\
- end\
- end\
- -----\
- function folder_system()\
- if menuHide == 0 and folderHide == 0 and button == 1 and event == \"mouse_click\" then\
- if x == 3 and y == 3 or x == 4 and y == 3 or x == 5 and y == 3 or x == 3 and y == 4 or x == 4 and y == 4 or x == 5 and y == 4 or x == 6 and y == 4 or x == 7 and y == 4 or x == 8 and y == 4 or x == 3 and y == 5 or x == 4 and y == 5 or x == 5 and y == 5 or x == 6 and y == 5 or x == 7 and y == 5 or x == 8 and y == 5 or x == 3 and y == 6 or x == 6 and y == 6 or x == 7 and y == 6 or x == 8 and y == 6 then\
- local select = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
- folderHide = 1\
- paintutils.drawImage(select,2,3)\
- paintutils.drawImage(folder,3,3)\
- term.setBackgroundColor(colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(3,8)\
- term.write(\"System\")\
- sleep(0.154)\
- folderin_draw()\
- term.setCursorPos(21,3)\
- term.setBackgroundColor(colors.gray)\
- term.write(\"System/\")\
- term.setCursorPos(6,3)\
- term.setTextColor(colors.gray)\
- term.setBackgroundColor(colors.lightGray)\
- term.write(\"<>\")\
- term.setCursorPos(1,2)\
- term.setBackgroundColor(colors.gray)\
- term.setTextColor(colors.red)\
- term.write(\"0\")\
- term.setCursorPos(2,2)\
- term.setTextColor(colors.yellow)\
- term.write(\"0\")\
- term.setCursorPos(3,2)\
- term.setTextColor(colors.green)\
- term.write(\"0\")\
- -----folders----infolder--\
- paintutils.drawImage(folder,10,6)\
- paintutils.drawImage(folder,18,6)\
- paintutils.drawImage(folder,26,6)\
- term.setCursorPos(10,11)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.white)\
- term.write(\" Main\")\
- term.setCursorPos(18,11)\
- term.write(\" OS\")\
- term.setCursorPos(26,11)\
- term.write(\"Pictures\")\
- \
- \
- --------------------------\
- end\
- \
- \
- end\
- \
- \
- \
- end\
- --\
- --\
- function IconBackSys()\
- if folderHide == 1 and button == 1 then\
- if menuHide == 0 and x == 6 and y == 3 then\
- folderHide = 0\
- menuHide = 0\
- paintutils.drawPixel(6,3,colors.blue)\
- term.setCursorPos(6,3)\
- term.setTextColor(colors.white)\
- term.setBackgroundColor(colors.blue)\
- term.write(\"<\")\
- sleep(0.165)\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- fileName()\
- desktop()\
- time()\
- osmenu()\
- end\
- end\
- end\
- --\
- --\
- function fold_sys_close()\
- if folderHide == 1 and button == 1 then\
- if x == 1 and y == 2 then\
- folderHide = 0\
- menuHide = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- fileName()\
- desktop()\
- time()\
- osmenu()\
- folderHide = 0\
- end\
- end\
- end\
- --\
- --\
- function osCol()\
- if menuHide == 0 then\
- term.setTextColor(colors.white)\
- term.setCursorPos(1,1)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"OS\")\
- end\
- end\
- --\
- --------------disk-----------\
- function diske()\
- local winDisk = 0\
- local event,side = os.pullEvent()\
- if event == \"disk\" then\
- pidor = paintutils.loadImage(\"System/Pictures/Disk/Enter\")\
- paintutils.drawImage(pidor,20,3)\
- winDisk = 1\
- \
- ---temoak\
- ----new---\
- ----pidor--kupec\
- ---Civilization----dla----pidorov\
- end\
- end\
- function diskWinClose()\
- if winDisk == 1 and button == 1 and x == 20 and y == 3 then\
- winDisk = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- time()\
- osmenu()\
- end\
- end\
- -----------------------------\
- function clscr()\
- gui()\
- fileName()\
- desktop()\
- time()\
- term.setCursorPos(1,1)\
- end\
- clscr()\
- function whileRun()\
- OSDRAW()\
- closebar()\
- exit()\
- folder_system()\
- fold_sys_close()\
- IconBackSys()\
- osCol()\
- paint_app()\
- context_call()\
- context_touch()\
- diske()\
- diskWinClose()\
- end\
- function timeRun()\
- while 1 do\
- time()\
- sleep(1)\
- paintutils.drawLine(44,1,51,1,colors.blue)\
- end\
- end\
- while OSWHILE do\
- whileRun()\
- end",
- OSEL_US = "os.loadAPI(\"GUI\")\
- ---StartOs\
- term.clear()\
- os.pullEvent = os.pullEventRaw\
- ----\
- log = fs.open(\"System/Config/clog.cfg\",\"r\")\
- logr = log.readLine()\
- log.close()\
- pas = fs.open(\"System/Config/pas.cfg\",\"r\")\
- pasr = pas.readLine()\
- pas.close()\
- ---login--\
- function login()\
- term.clear()\
- local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
- paintutils.drawImage(load,1,1)\
- term.setTextColor(colors.black)\
- paintutils.drawFilledBox(15,5,37,8,colors.lightGray)\
- paintutils.drawFilledBox(16,6,36,7,colors.white)\
- term.setCursorPos(16,6)\
- local wileX = true\
- function passwordIn()\
- paintutils.drawLine(16,7,33,7,colors.white)\
- term.setCursorPos(16,6)\
- term.write(\" \")\
- term.setCursorPos(16,6)\
- term.write(\" Password:\")\
- local password = read(\"*\")\
- if password == pasr then\
- wileX = false\
- welcome()\
- else\
- term.setTextColor(colors.red)\
- paintutils.drawLine(16,7,33,7,colors.white)\
- term.setCursorPos(16,7)\
- term.write(\" Wrong password!\")\
- term.setCursorPos(23,6)\
- term.setTextColor(colors.black)\
- passwordIn()\
- end\
- ------\
- end\
- --\
- --\
- --\
- function inLog()\
- term.setTextColor(colors.black)\
- paintutils.drawLine(16,6,33,6,colors.white)\
- term.setCursorPos(16,6)\
- term.write(\" Login:\")\
- if read() == logr then\
- passwordIn()\
- else\
- paintutils.drawLine(16,7,33,7,colors.white)\
- term.setCursorPos(16,7)\
- term.setTextColor(colors.red)\
- term.write(\" Wrong login!\")\
- term.setTextColor(colors.black)\
- end\
- end\
- ----\
- --\
- --\
- function ENTER()\
- inLog()\
- end\
- while wileX do\
- ENTER()\
- end\
- end\
- ---\
- ---welcome--\
- function welcome()\
- term.clear()\
- local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
- paintutils.drawImage(load,1,1)\
- term.setTextColor(colors.red)\
- local i = 0\
- paintutils.drawPixel(23,9,colors.orange)\
- term.setCursorPos(23,9)\
- term.write(\"Welcome \")\
- term.setCursorPos(24,9)\
- term.setBackgroundColor(colors.gray)\
- term.write(\"e\")\
- term.setCursorPos(25,9)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"l\")\
- term.setCursorPos(28,9)\
- term.setBackgroundColor(colors.gray)\
- term.write(\"m\")\
- term.setCursorPos(29,9)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"e\")\
- sleep(0.2)\
- paintutils.drawPixel(20,11,colors.blue)\
- sleep(0.5)\
- paintutils.drawLine(21,11,26,11,colors.blue)\
- sleep(0.3)\
- paintutils.drawLine(27,11,30,11,colors.blue)\
- sleep(0.4)\
- paintutils.drawLine(30,11,32,11,colors.blue)\
- sleep(1)\
- ---\
- end\
- ---\
- function loadSys()\
- local load = paintutils.loadImage(\"System/Pictures/Icons/stus.plc\")\
- paintutils.drawImage(load,1,1)\
- paintutils.drawLine(20,11,32,11,colors.white)\
- term.setCursorPos(22,9)\
- term.setTextColor(colors.orange)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"Lion OS X\")\
- term.setTextColor(colors.black)\
- term.setCursorPos(40,19)\
- term.write(\"ZfelfProg CC\")\
- term.setCursorPos(1,19)\
- term.write(\"AlexZfelf CC\")\
- sleep(1)\
- paintutils.drawPixel(20,11,colors.blue)\
- sleep(1.2)\
- paintutils.drawLine(21,11,24,11,colors.blue)\
- sleep(1,3)\
- paintutils.drawLine(25,11,30,11,colors.blue)\
- sleep(1)\
- paintutils.drawLine(30,11,32,11,colors.blue)\
- sleep(1)\
- login()\
- end\
- ---\
- loadSys()\
- \
- -------\
- ---\
- ---background---color---as\
- \
- ---\
- -------\
- term.setBackgroundColor(colors.lightBlue)\
- term.clear()\
- term.setCursorPos(1,1)\
- -----\
- file = fs.open(\"color\",\"r\")\
- linec = file.readLine(textutils.serialise())\
- linecc = colors.lightBlue\
- if linec == \"colors.lightBlue\" or \"colors.green\" or \"colors.green\" then\
- if linec ~= nil then\
- linecc = linec\
- elseif linec == nil then\
- linecc = colors.lightBlue\
- end\
- end\
- SelectBc = {\
- [1] = colors.lightBlue\
- }\
- file.close()\
- ------osgui-----\
- function gui()\
- term.clear()\
- term.setBackgroundColor(SelectBc[1])\
- term.setCursorPos(1,1)\
- --------upbar----\
- function upbar()\
- paintutils.drawLine(1,1,44,1,colors.lightGray)\
- end\
- upbar()\
- ----iconW---\
- paintutils.drawPixel(1,1,colors.lightGray)\
- paintutils.drawPixel(2,1,colors.lightGray)\
- term.setCursorPos(1,1)\
- term.setTextColor(colors.white)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"OS\")\
- -----clock----\
- paintutils.drawLine(45,1,51,1,colors.blue)\
- end\
- ------timeclock----\
- function time()\
- local time = os.time()\
- local ftime = textutils.formatTime(time,false)\
- term.setTextColor(colors.white)\
- term.setBackgroundColor(colors.blue)\
- term.setCursorPos(44,1)\
- term.write(ftime)\
- end\
- function desktop()\
- folder = paintutils.loadImage(\"System/Pictures/Icons/folder.pic\")\
- program = paintutils.loadImage(\"System/Pictures/Icons/program.pic\")\
- file = paintutils.loadImage(\"System/Pictures/Icons/file.pic\")\
- paint = paintutils.loadImage(\"System/Pictures/Icons/paint.exe\")\
- paintutils.drawImage(folder,3,3) \
- paintutils.drawImage(paint,11,3)\
- end\
- function fileName()\
- naziF = 0\
- if naziF == 0 then\
- term.setCursorPos(3,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(SelectBc[1])\
- term.write(\"System\")\
- term.setCursorPos(11,8)\
- term.write(\" Paint\")\
- end\
- if naziF == 1 then\
- term.setCursorPos(3,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(SelectBc[1])\
- term.write(\"System\")\
- term.setCursorPos(11,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.red)\
- term.write(\"Pa\")\
- term.setBackgroundColor(colors.white)\
- term.write(\"int\")\
- end\
- end\
- function select()\
- sel = paintutils.loadImage(\"select.pic\")\
- end\
- menuHide = 0\
- folderHide = 0\
- function osmenu()\
- menu = paintutils.loadImage(\"System/Pictures/Icons/osMenu.cpic\")\
- event,button,x,y = os.pullEvent()\
- if event == \"mouse_click\" then\
- if menuHide == 0 and folderHide == 0 and button == 1 and x == 1 and y == 1 or menuHide == 0 and button == 1 and x == 2 and y == 1 then\
- paintutils.drawImage(menu,2,2)\
- term.setCursorPos(1,1)\
- term.setBackgroundColor(colors.blue)\
- term.write(\"OS\")\
- sleep(0.140)\
- ------button---options----\
- term.setCursorPos(3,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Options\")\
- paintutils.drawPixel(10,8,colors.lightGray)\
- term.setCursorPos(10,8)\
- term.write(\">\")\
- ------button---shutdown---\
- term.setCursorPos(3,9)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Reboot\")\
- paintutils.drawPixel(10,9,colors.lightGray)\
- term.setCursorPos(10,9)\
- term.write(\">\")\
- ------button---folder----\
- term.setCursorPos(3,7)\
- term.setBackgroundColor(colors.white)\
- term.write(\"My CC\")\
- paintutils.drawPixel(10,7,colors.lightGray)\
- term.setCursorPos(10,7)\
- term.write(\">\")\
- ------button---exit-------\
- term.setCursorPos(3,6)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Shutdown\")\
- paintutils.drawPixel(10,6,colors.lightGray)\
- term.setCursorPos(10,6)\
- term.write(\">\")\
- ------button---closebar---\
- term.setCursorPos(3,2)\
- term.setBackgroundColor(colors.white)\
- term.write(\"Hide\")\
- paintutils.drawPixel(10,2,colors.yellow)\
- term.setCursorPos(10,2)\
- term.write(\">\")\
- term.setCursorPos(2,3)\
- term.setTextColor(colors.lightGray)\
- term.setBackgroundColor(colors.white)\
- term.write(\"---------\")\
- ------button---\
- menuHide = 1\
- end\
- end\
- end\
- winhide = 0\
- function mSettings()\
- if menuHide == 1 then\
- if button == 1 and x == 10 and y == 8 then\
- menuHide = 0\
- folderHide = 0\
- paintutils.drawPixel(10,8,colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(10,8)\
- term.write(\">\")\
- sleep(0.143)\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- time()\
- fileName()\
- function winOP()\
- window = paintutils.loadImage(\"System/Pictures/Win/win.plw\")\
- paintutils.drawImage(window,7,3)\
- -------textin---win--\
- term.setCursorPos(8,5)\
- term.setBackgroundColor(colors.white)\
- term.setTextColor(colors.black)\
- term.write(\" Background color: \")\
- paintutils.drawPixel(27,5,colors.green)\
- paintutils.drawPixel(28,5,colors.lightBlue)\
- paintutils.drawPixel(29,5,colors.red)\
- paintutils.drawPixel(30,5,colors.pink)\
- term.setCursorPos(8,7)\
- term.setBackgroundColor(colors.white)\
- term.write(\" Selected: \")\
- paintutils.drawPixel(19,7,SelectBc[1])\
- term.setCursorPos(8,9)\
- term.setBackgroundColor(colors.white)\
- term.write(\" Save & Exit\")\
- term.setCursorPos(21,9)\
- term.write(\">\")\
- end\
- winOP()\
- menuHide = 0\
- \
- \
- \
- \
- -----endtetx----\
- winhide = 1\
- elseif folderHide == 1 then\
- \
- end\
- end\
- end\
- \
- function txwin()\
- if menuHide == 0 and folderHide == 0 and event == \"mouse_click\" then\
- if winhide == 1 then\
- if button == 1 and x == 7 and y == 3 then\
- menuHide = 0\
- winhide = 0\
- time()\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- osmenu()\
- end\
- end\
- end\
- end\
- function shutdown()\
- if menuHide == 1 then\
- if button == 1 and x == 10 and y == 9 then\
- paintutils.drawPixel(10,9,colors.red)\
- term.setTextColor(colors.white)\
- term.setCursorPos(10,9)\
- term.write(\">\")\
- sleep(0.144)\
- os.reboot()\
- end\
- end\
- function func()\
- if menuHide == 1 then\
- if button == 1 and x == 10 and y == 7 then\
- paintutils.drawPixel(10,7,colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(10,7)\
- term.write(\">\")\
- end\
- \
- end\
- \
- end\
- \
- end\
- function OSDRAW()\
- mSettings()\
- osmenu()\
- txwin()\
- pickcolor()\
- shutdown()\
- func()\
- \
- end\
- OSWHILE = true\
- function exit()\
- if menuHide == 1 and button == 1 and x == 10 and y == 6 then\
- paintutils.drawPixel(10,6,colors.blue)\
- term.setCursorPos(10,6)\
- term.setTextColor(colors.white)\
- term.write(\">\")\
- sleep(0.143)\
- os.shutdown()\
- end\
- end\
- ----\
- function closebar()\
- if menuHide == 1 then\
- if folderHide == 0 and menuHide == 1 and button == 1 and x == 10 and y == 2 then\
- paintutils.drawPixel(10,2,colors.blue)\
- term.setCursorPos(10,2)\
- term.setTextColor(colors.white)\
- term.write(\">\")\
- sleep(0.144)\
- term.setCursorPos(1,1)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"OS\")\
- term.setBackgroundColor(SelectBc[1])\
- menuHide = 0\
- gui()\
- desktop()\
- fileName()\
- time()\
- osmenu()\
- elseif folderHide == 1 and button == 1 and x == 10 and y == 2 then\
- filD = paintutils.loadImage(\"System/Pictures/FolderIn/menuHide.pic\")\
- paintutils.drawImage(filD,2,2)\
- menuHide = 0\
- term.setCursorPos(6,3)\
- term.setBackgroundColor(colors.lightGray)\
- term.setTextColor(colors.black)\
- term.write(\"<>\")\
- term.setBackgroundColor(colors.gray)\
- term.setCursorPos(2,2)\
- term.setTextColor(colors.yellow)\
- term.write(\"0\")\
- term.setCursorPos(3,2)\
- term.setTextColor(colors.green)\
- term.write(\"0\")\
- elseif winhide == 1 and button == 1 and x == 10 and y == 2 then\
- menuHide = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- time()\
- osmenu()\
- paintutils.drawImage(window,7,3)\
- winOP()\
- end\
- end\
- end\
- \
- \
- \
- ----func---color----pick\
- function pickcolor()\
- local file = fs.open(\"color\",\"w\")\
- if winhide == 1 then\
- if button == 1 and x == 27 and y == 5 then\
- SelectBc[1] = colors.green\
- paintutils.drawPixel(19,7,SelectBc[1])\
- file.write(\"colors.green\")\
- elseif x == 28 and y == 5 then\
- SelectBc[1] = colors.lightBlue\
- paintutils.drawPixel(19,7,SelectBc[1])\
- file.write(\"colors.lightBlue\")\
- elseif x == 29 and y == 5 then\
- SelectBc[1] = colors.red\
- naziF = 1\
- paintutils.drawPixel(19,7,SelectBc[1])\
- nazi = paintutils.loadImage(\"System/wallpapers/grammarnazi.fuck\")\
- paintutils.drawImage(nazi,1,2)\
- fileName()\
- desktop()\
- file.write(\"colors.red\")\
- elseif x == 30 and y == 5 then\
- SelectBc[1] = colors.pink\
- paintutils.drawPixel(19,7,SelectBc[1])\
- file.write(\"colors.pink\")\
- elseif x == 21 and y == 9 then\
- file.close()\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- fileName()\
- desktop()\
- time()\
- end\
- end\
- end\
- ----\
- --\
- contextdraw = 0\
- function context_draw()\
- contextr = paintutils.loadImage(\"System/Pictures/Menus/Context.pic\")\
- paintutils.drawImage(contextr,x,y)\
- term.setCursorPos(x+1,y)\
- term.setBackgroundColor(colors.white)\
- term.setTextColor(colors.black)\
- term.write(\"Open\")\
- term.setCursorPos(x+7,y)\
- term.setBackgroundColor(colors.yellow)\
- term.write(\">\")\
- term.setCursorPos(x,y+1)\
- term.setTextColor(colors.lightGray)\
- term.setBackgroundColor(colors.white)\
- term.write(\"--------\")\
- term.setCursorPos(x+1,y+6)\
- term.setTextColor(colors.black)\
- term.write(\"Info\")\
- term.setCursorPos(x+7,y+6)\
- term.setBackgroundColor(colors.yellow)\
- term.write(\">\")\
- contextdraw = 1\
- end\
- ---context-----touch---\
- function context_touch()\
- if contextdraw == 1 and folderHide == 0 and y ~= 1 then\
- if button == 1 and folderHide == 0 then\
- contextdraw = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- time()\
- menuHide = 0\
- end\
- end\
- end\
- ----\
- function context_drawLeft()\
- contextl = paintutils.loadImage(\"System/Pictures/Menus/ContexLeft.pic\")\
- paintutils.drawImage(contextl,43,y)\
- end\
- --\
- function context_call()\
- local math = 45\
- local xx = x\
- if y ~= 1 and x ~= 45 or x ~= 46 or x ~= 47 or x ~= 48 or x ~= 49 or x ~= 50 or x ~= 51 then\
- if button == 2 and contextdraw == 0 then\
- context_draw()\
- contextdraw = 1\
- end\
- elseif xx > math then\
- context_drawLeft()\
- contextdraw = 1\
- end\
- end\
- ----\
- --\
- function folderin_draw()\
- folderin = paintutils.loadImage(\"System/Pictures/FolderIn/oldf.plw\")\
- paintutils.drawImage(folderin,1,2)\
- end\
- --\
- ----\
- function paint_app()\
- if button == 1 then\
- if x == 11 and y == 3 or x == 12 and y == 3 or x == 13 and y == 3 or x == 14 and y == 3 or x == 15 and y == 3 or x == 16 and y == 3 or x == 11 and y == 4 or x == 12 and y == 4 or x == 14 and y == 4 or x == 14 and y == 4 or x == 15 and y == 4 or x == 16 and y == 4 or x == 11 and y == 5 or x == 12 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 16 and y == 5 or x == 11 and y == 6 or x == 12 and y == 6 or x == 16 and y == 6 or x == 16 and y == 6 or x == 16 then\
- selC = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
- paintutils.drawImage(selC,10,3)\
- paintutils.drawImage(paint,11,3)\
- term.setBackgroundColor(colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(11,8)\
- term.write(\" Paint\")\
- sleep(0.155)\
- shell.run(\"System/Programms/paint.cc\")\
- end\
- end\
- end\
- -----\
- function folder_system()\
- if menuHide == 0 and folderHide == 0 and button == 1 and event == \"mouse_click\" then\
- if x == 3 and y == 3 or x == 4 and y == 3 or x == 5 and y == 3 or x == 3 and y == 4 or x == 4 and y == 4 or x == 5 and y == 4 or x == 6 and y == 4 or x == 7 and y == 4 or x == 8 and y == 4 or x == 3 and y == 5 or x == 4 and y == 5 or x == 5 and y == 5 or x == 6 and y == 5 or x == 7 and y == 5 or x == 8 and y == 5 or x == 3 and y == 6 or x == 6 and y == 6 or x == 7 and y == 6 or x == 8 and y == 6 then\
- local select = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
- folderHide = 1\
- paintutils.drawImage(select,2,3)\
- paintutils.drawImage(folder,3,3)\
- term.setBackgroundColor(colors.blue)\
- term.setTextColor(colors.white)\
- term.setCursorPos(3,8)\
- term.write(\"System\")\
- sleep(0.154)\
- folderin_draw()\
- term.setCursorPos(21,3)\
- term.setBackgroundColor(colors.gray)\
- term.write(\"System/\")\
- term.setCursorPos(6,3)\
- term.setTextColor(colors.gray)\
- term.setBackgroundColor(colors.lightGray)\
- term.write(\"<>\")\
- term.setCursorPos(1,2)\
- term.setBackgroundColor(colors.gray)\
- term.setTextColor(colors.red)\
- term.write(\"0\")\
- term.setCursorPos(2,2)\
- term.setTextColor(colors.yellow)\
- term.write(\"0\")\
- term.setCursorPos(3,2)\
- term.setTextColor(colors.green)\
- term.write(\"0\")\
- -----folders----infolder--\
- paintutils.drawImage(folder,10,6)\
- paintutils.drawImage(folder,18,6)\
- paintutils.drawImage(folder,26,6)\
- term.setCursorPos(10,11)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.white)\
- term.write(\" Main\")\
- term.setCursorPos(18,11)\
- term.write(\" OS\")\
- term.setCursorPos(26,11)\
- term.write(\"Pictures\")\
- \
- \
- --------------------------\
- end\
- \
- \
- end\
- \
- \
- \
- end\
- --\
- --\
- function IconBackSys()\
- if folderHide == 1 and button == 1 then\
- if menuHide == 0 and x == 6 and y == 3 then\
- folderHide = 0\
- menuHide = 0\
- paintutils.drawPixel(6,3,colors.blue)\
- term.setCursorPos(6,3)\
- term.setTextColor(colors.white)\
- term.setBackgroundColor(colors.blue)\
- term.write(\"<\")\
- sleep(0.165)\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- fileName()\
- desktop()\
- time()\
- osmenu()\
- end\
- end\
- end\
- --\
- --\
- function fold_sys_close()\
- if folderHide == 1 and button == 1 then\
- if x == 1 and y == 2 then\
- folderHide = 0\
- menuHide = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- fileName()\
- desktop()\
- time()\
- osmenu()\
- folderHide = 0\
- end\
- end\
- end\
- --\
- --\
- function osCol()\
- if menuHide == 0 then\
- term.setTextColor(colors.white)\
- term.setCursorPos(1,1)\
- term.setBackgroundColor(colors.cyan)\
- term.write(\"OS\")\
- end\
- end\
- --\
- --------------disk-----------\
- function diske()\
- local winDisk = 0\
- local event,side = os.pullEvent()\
- if event == \"disk\" then\
- pidor = paintutils.loadImage(\"System/Pictures/Disk/Enter\")\
- paintutils.drawImage(pidor,20,3)\
- winDisk = 1\
- \
- ---temoak\
- ----new---\
- ----pidor--kupec\
- ---Civilization----dla----pidorov\
- end\
- end\
- function diskWinClose()\
- if winDisk == 1 and button == 1 and x == 20 and y == 3 then\
- winDisk = 0\
- term.setBackgroundColor(SelectBc[1])\
- gui()\
- desktop()\
- fileName()\
- time()\
- osmenu()\
- end\
- end\
- -----------------------------\
- function clscr()\
- gui()\
- fileName()\
- desktop()\
- time()\
- term.setCursorPos(1,1)\
- end\
- clscr()\
- function whileRun()\
- OSDRAW()\
- closebar()\
- exit()\
- folder_system()\
- fold_sys_close()\
- IconBackSys()\
- osCol()\
- paint_app()\
- context_call()\
- context_touch()\
- diske()\
- diskWinClose()\
- end\
- function timeRun()\
- while 1 do\
- time()\
- sleep(1)\
- paintutils.drawLine(44,1,51,1,colors.blue)\
- end\
- end\
- while OSWHILE do\
- whileRun()\
- end",
- },
- Programms = {
- [ "Paint.cc" ] = "os.pullEvent = os.pullEventRaw\
- local xSize,ySize = term.getSize()\
- local colorPIX = colors.white\
- local Eraser = {\
- [1] = colors.white\
- }\
- ------\
- local Pixels = {}\
- for j=1,(ySize-1) do\
- Pixels[j] = {}\
- for i=1,xSize do\
- Pixels[j][i] = colors.white\
- end\
- end\
- \
- \
- \
- local function gui2()\
- for j=1,#Pixels do\
- for i=1,#Pixels[j] do\
- if Pixels[j][i] ~= nil then\
- paintutils.drawPixel(i,j+1,colorPIX)\
- end\
- end\
- end\
- end\
- \
- \
- \
- \
- ------\
- local SelectColor = {\
- [1]=colors.black\
- }\
- term.clear()\
- term.setCursorPos(xSize,1)\
- term.setTextColor(colors.lightGray)\
- print(\"X\")\
- gui()\
- local whileX = 1\
- ------\
- local t = 0\
- local u = 0\
- while t < xSize do\
- t = t + 1\
- u = u + 1\
- paintutils.drawPixel(2,1,colors.black)\
- paintutils.drawPixel(3,1,colors.red)\
- paintutils.drawPixel(4,1,colors.green)\
- paintutils.drawPixel(5,1,colors.blue)\
- paintutils.drawPixel(6,1,colors.yellow)\
- paintutils.drawPixel(7,1,colors.orange)\
- paintutils.drawPixel(8,1,colors.magenta)\
- paintutils.drawPixel(9,1,colors.lightBlue)\
- paintutils.drawPixel(10,1,colors.lime)\
- paintutils.drawPixel(11,1,colors.pink)\
- paintutils.drawPixel(12,1,colors.gray)\
- paintutils.drawPixel(13,1,colors.lightGray)\
- paintutils.drawPixel(14,1,colors.cyan)\
- paintutils.drawPixel(15,1,colors.purple)\
- paintutils.drawPixel(16,1,colors.brown)\
- paintutils.drawPixel(17,1,colors.white)\
- paintutils.drawPixel(u,1,colors.gray)\
- term.setCursorPos(30,1)\
- term.setTextColor(colors.green)\
- term.write(\"Made by ALZF\")\
- term.setTextColor(colors.white)\
- term.setCursorPos(1,1)\
- term.write(\"[\")\
- term.setCursorPos(21,1)\
- term.setTextColor(colors.red)\
- term.write(\"E\")\
- term.setCursorPos(22,1)\
- term.write(\"C\")\
- term.setCursorPos(23,1)\
- term.write(\"F\")\
- term.setCursorPos(xSize,1)\
- term.write(\"X\")\
- term.setTextColor(colors.white)\
- term.setCursorPos(24,1)\
- term.write(\"#\")\
- term.setCursorPos(26,1)\
- term.write(\"[\")\
- term.setCursorPos(28,1)\
- term.write(\"]\")\
- term.setCursorPos(18,1)\
- term.write(\"]\")\
- term.setCursorPos(20,1)\
- term.write(\"#\")\
- end\
- while whileX == 1 do\
- local event,button,x,y = os.pullEvent()\
- if event == \"mouse_click\" or event == \"mouse_drag\" then\
- if button == 1 and y > 1 then\
- paintutils.drawPixel(x,y,SelectColor[1])\
- elseif button == 1 and x == 3 and y == 1 then\
- SelectColor[1] = colors.red\
- colorPIX = colors.red\
- elseif button == 1 and x == 2 and y == 1 then\
- SelectColor[1] = colors.black\
- colorPIX = colors.black\
- elseif button == 1 and x == 4 and y == 1 then\
- SelectColor[1] = colors.green\
- colorPIX = colors.green\
- elseif button == 1 and x == 5 and y == 1 then\
- SelectColor[1] = colors.blue\
- colorPIX = colors.blue\
- elseif button == 1 and x == 6 and y == 1 then\
- SelectColor[1] = colors.yellow\
- colorPIX = colors.yellow\
- elseif button == 1 and x == 7 and y == 1 then\
- SelectColor[1] = colors.orange\
- colorPIX = colors.orange\
- elseif button == 1 and x == 8 and y == 1 then\
- SelectColor[1] = colors.magenta\
- colorPIX = colors.magenta\
- elseif button == 1 and x == 9 and y == 1 then\
- SelectColor[1] = colors.lightBlue\
- colorPIX = colors.lightBlue\
- elseif button == 1 and x == 10 and y == 1 then\
- SelectColor[1] = colors.lime\
- colorPIX = colors.lime\
- elseif button == 1 and x == 11 and y == 1 then\
- SelectColor[1] = colors.pink\
- colorPIX = colors.pink\
- elseif button == 1 and x == 12 and y == 1 then\
- SelectColor[1] = colors.gray\
- colorPIX = colors.gray\
- elseif button == 1 and x == 13 and y == 1 then\
- SelectColor[1] = colors.lightGray\
- colorPIX = colors.lightGray\
- elseif button == 1 and x == 14 and y == 1 then\
- SelectColor[1] = colors.cyan\
- colorPIX = colors.cyan\
- elseif button == 1 and x == 15 and y == 1 then\
- SelectColor[1] = colors.purple\
- colorPIX = colors.purple\
- elseif button == 1 and x == 16 and y == 1 then\
- SelectColor[1] = colors.brown\
- colorPIX = colors.brown\
- elseif button == 1 and x == 17 and y == 1 then\
- SelectColor[1] = colors.white\
- colorPIX = colors.white\
- elseif button == 1 and x == 21 and y == 1 then\
- SelectColor[1] = Eraser[1]\
- elseif button == 1 and x == 23 and y == 1 then\
- Eraser[1] = colorPIX\
- gui2()\
- elseif button == 1 and x == 22 and y == 1 then\
- colorPIX = colors.white\
- gui2()\
- elseif button == 1 and x == xSize and y == 1 then\
- term.clear()\
- whileX = 0\
- ----\
- gui2()\
- if whileX == 0 then\
- term.clear()\
- term.setBackgroundColor(SelectBc[1])\
- clscr()\
- paintutils.drawLine(3,1,44,1,colors.lightGray)\
- time()\
- menuHide = 0\
- end\
- end\
- end\
- paintutils.drawPixel(27,1,SelectColor[1])\
- if whileX == 0 then\
- paintutils.drawPixel(27,1,colors.lightGray)\
- menuHide = 0\
- end\
- end",
- },
- Pictures = {
- Icons = {
- [ "folderFile.pic" ] = "440\
- 444444\
- 444444\
- 444444",
- [ "stus2.plc" ] = "777777777777777777777777777777777777777777777777777\
- 777777777777777777777777777ff7777777777777777777777\
- 77777777777777777777777777ff77777777777777777777777\
- 7777777777777777777777777ff777777777777777777777777\
- 777777777777777777777777777777777777777777777777777\
- 777777777777777777777ffffffffff77777777777777777777\
- 77777777777777777777fffffffffffff777777777777777777\
- 7777777777777777777fffffffffffffff77777777777777777\
- 777777777777777777ffffffffffffff7777777777777777777\
- 77777777777777777fffffffffffff777777777777777777777\
- 77777777777777777ffffffffffff7777777777777777777777\
- 77777777777777777ffffffffffff7777777777777777777777\
- 77777777777777777fffffffffffff777777777777777777777\
- 777777777777777777ffffffffffffff7777777777777777777\
- 7777777777777777777fffffffffffffff77777777777777777\
- 77777777777777777777fffffffffffff777777777777777777\
- 777777777777777777777ffffffffff77777777777777777777\
- 777777777777777777777777777777777777777777777777777",
- [ "welcus.plc" ] = "999999999999999999999999999999999999999999999999999\
- 999999999900009999999999999999999999999999999000009\
- 999000000000000999999999999999999999999990000000000\
- 999000001100001199111119999001199447999447000000000\
- 999900001170000079117117011001170044794470000000000\
- 999990001170001179117117011101170000447700000000000\
- 999999001179991179117117911111170000447000000099900\
- 999999991111791179117117911711170944794479999999999\
- 999999991111791179111117911771179447999447999999999\
- 999999999777799779997777977797779999999999999999999\
- 999999999995559999909999999999999999999999999999999\
- 999555999995559999999999999999999999999999999555999\
- 999555999999c99999999dd99999999999ddddd999999555999\
- 9999c99ddddddddddddddddddd9999999ddddddddddd99c9999\
- ddddddddddddddddddddddddddddddddddddddddddddddddddd\
- ddddddddddddddddddddddddddddddddddddddddddddddddddd\
- ddddddddddddddddddddddddddddddddddddddddddddddddddd\
- ddddddddddddddddddddddddddddddddddddddddddddddddddd\
- ddddddddddddddddddddddddddddddddddddddddddddddddddd",
- Windows = {
- [ "win25x10.pic" ] = "e1d7777777777777777777777\
- 0000000000000000000000000\
- 0000000000000000000000000\
- 0000000000000000000000000\
- 0000000000000000000000000\
- 0000000000000000000000000\
- 0000000000000000000000000\
- 0000000000000000000000000\
- 0000000000000000000000000\
- 0000000000000000000000000",
- [ "win15x5.pic" ] = "e1d777777777777\
- 000000000000000\
- 000000000000000\
- 000000000000000\
- 000000000000000\
- 000000000000000",
- },
- OS = {
- Desktop = {
- [ "win.pic" ] = "\
- \
- 00000000 00000000\
- 00000000000 00000000000\
- 0000000000000 0000000000000\
- 0000000000000 0000000000000\
- 0000000000000 0000000000000\
- 0000000000000 0000000000000\
- \
- 0000000000000 0000000000000\
- 0000000000000 0000000000000\
- 0000000000000 0000000000000\
- 0000000000000 0000000000000\
- 00000000000 00000000000\
- 00000000 00000000",
- },
- },
- [ "program.pic" ] = "fffff\
- fffff\
- fffff\
- fffff",
- [ "file.pic" ] = "000000\
- 000000\
- 000000\
- 000000",
- [ "osMenu.cpic" ] = "000000000\
- 0000000007\
- 0000000007\
- 0000000007\
- 0000000007\
- 0000000007\
- 0000000007\
- 0000000007\
- 777777777",
- [ "select.pic" ] = "bbbbbbbb\
- bbbbbbbb\
- bbbbbbbb\
- bbbbbbbb\
- bbbbbbbb\
- bbbbbbbb",
- [ "paint.exe" ] = "c1b4cf\
- f5eecc\
- fbe4bc\
- fb5c1c",
- [ "folder.pic" ] = "441\
- 444444\
- 444444\
- 444444",
- [ "stus.plc" ] = "999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999 --centre/2\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999900000000000009999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999",
- },
- Win = {
- [ "win.plw" ] = "e1d7777777777777777777777777777777\
- 0000000000000000000000000000000000\
- 8000000000000000000000000000000000\
- 0000000000000000000000000000000000\
- 8000000000000000000000000000000000\
- 0000000000000000000000000000000000\
- 8000000000000000000000000000000000\
- 0000000000000000000000000000000000\
- 8000000000000000000000000000000000\
- 0000000000000000000000000000000000\
- 0000000000000000000000000000000000",
- },
- Disk = {
- Enter = "e4d7777777777\
- 0000000000000\
- 0000000000000\
- 0000000000000\
- 0000000000000\
- 0000000000000",
- },
- Menus = {
- [ "Context.pic" ] = "00000000\
- 000000007\
- 000000007\
- 000000007\
- 000000007\
- 000000007\
- 000000007\
- 77777777",
- [ "ContexLeft.pic" ] = " 00000000\
- 700000000\
- 700000000\
- 700000000\
- 700000000\
- 700000000\
- 700000000\
- 77777777",
- },
- FolderIn = {
- [ "oldf.plw" ] = "e1d777777777777777777777777777777777777777777777777\
- 777778877777777777777777777777777777800000000000007\
- 777777777777777777777777777777777777777777777777777\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 333333330000000000000000000000000000000000000000000\
- 777777777777777777777777777777777777777777777777777\
- \
- ",
- [ "menuHide.pic" ] = "777777777\
- 7777887777\
- 7777777777\
- 3333333000\
- 3333333044\
- 3333333044\
- 3333333044\
- 3333333044\
- 3333333000",
- },
- },
- wallpapers = {
- [ "grammarnazi.fuck" ] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeeeeeee000000000eeeeeeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeeee000000ff0000000eeeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeee000000fff00000000eeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeee000000fff0000000000eeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeee000000fff0000ff000000eeeeeeeeeeeeeee\
- eeeeeeeeeeeeee000000fff0000ffff000000eeeeeeeeeeeeee\
- eeeeeeeeeeeee000000fff0000ffffff000000eeeeeeeeeeeee\
- eeeeeeeeeeeee00000fff0000fff0ffff00000eeeeeeeeeeeee\
- eeeeeeeeeeeee00000fff000fff000fff00000eeeeeeeeeeeee\
- eeeeeeeeeeeee000000fff00ff000fff000000eeeeeeeeeeeee\
- eeeeeeeeeeeeee000000fff00000fff000000eeeeeeeeeeeeee\
- eeeeeeeeeeeeeee000000fff000fff000000eeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeee000000fff0fff000000eeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeee000000fffff000000eeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeeee000000fff000000eeeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeeeeeee000000000eeeeeeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
- eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- },
- Os = {
- Main = {
- Os = {
- [ "mindows.osq" ] = "term.setBackgroundColor(colors.lightBlue)\
- term.clear()\
- term.setCursorPos(1,1)\
- -----wallpaper\
- local imgwin = paintutils.loadImage(\"System/Pictures/Icons/OS/Desktop/win.pic\")\
- paintutils.drawImage(imgwin,2,1)\
- ------osgui-----\
- function gui()\
- --------downtoolbar----\
- paintutils.drawLine(1,18,51,18,colors.gray)\
- ----iconW---\
- paintutils.drawPixel(1,18,colors.lightGray)\
- -----clock----\
- paintutils.drawLine(45,18,51,18,colors.blue)\
- end\
- ------timeclock----\
- function time()\
- local time = os.time()\
- local ftime = textutils.formatTime(time,false)\
- term.setCursorPos(45,18)\
- term.write(ftime)\
- end\
- function desktop()\
- local folder = paintutils.loadImage(\"System/Pictures/Icons/folder.pic\")\
- local program = paintutils.loadImage(\"System/Pictures/Icons/program.pic\")\
- local file = paintutils.loadImage(\"System/Pictures/Icons/file.pic\")\
- paintutils.drawImage(folder,3,3) \
- paintutils.drawImage(program,10,3)\
- term.setCursorPos(11,4)\
- term.setTextColor(colors.yellow)\
- term.write(\">_\")\
- end\
- function fileName()\
- term.setCursorPos(3,8)\
- term.setTextColor(colors.black)\
- term.setBackgroundColor(colors.lightBlue)\
- end\
- function select()\
- local sel = paintutils.loadImage(\"select.pic\")\
- end\
- \
- gui()\
- fileName()\
- desktop()\
- time()",
- },
- },
- },
- Apis = {
- GUI = {
- gui = "-------------------------------------------------------------------------------------------\
- ---Custon drawing API\
- -------------------------------------------------------------------------------------------\
- local function drawPixelInternal( target, xPos, yPos )\
- \009target.setCursorPos(xPos, yPos)\
- \009target.write(\" \")\
- end\
- \
- local function drawPixel(target, xPos, yPos, nColour )\
- \009if nColour then\
- \009\009target.setBackgroundColor( nColour )\
- \009end\
- \009drawPixelInternal( target, xPos, yPos )\
- end\
- \
- local function drawLine(target, startX, startY, endX, endY, nColour )\
- \009if nColour then\
- \009\009target.setBackgroundColor( nColour )\
- \009end\
- \009\
- \009startX = math.floor(startX)\
- \009startY = math.floor(startY)\
- \009endX = math.floor(endX)\
- \009endY = math.floor(endY)\
- \009\
- \009if startX == endX and startY == endY then\
- \009\009drawPixelInternal( target, startX, startY )\
- \009\009return\
- \009end\
- \009\
- \009local minX = math.min( startX, endX )\
- \009if minX == startX then\
- \009\009minY = startY\
- \009\009maxX = endX\
- \009\009maxY = endY\
- \009else\
- \009\009minY = endY\
- \009\009maxX = startX\
- \009\009maxY = startY\
- \009end\
- \009\009\
- \009local xDiff = maxX - minX\
- \009local yDiff = maxY - minY\
- \009\009\009\
- \009if xDiff > math.abs(yDiff) then\
- \009\009local y = minY\
- \009\009local dy = yDiff / xDiff\
- \009\009for x=minX,maxX do\
- \009\009\009drawPixelInternal( target, x, math.floor( y + 0.5 ) )\
- \009\009\009y = y + dy\
- \009\009end\
- \009else\
- \009\009local x = minX\
- \009\009local dx = xDiff / yDiff\
- \009\009if maxY >= minY then\
- \009\009\009for y=minY,maxY do\
- \009\009\009\009drawPixelInternal( target, math.floor( x + 0.5 ), y )\
- \009\009\009\009x = x + dx\
- \009\009\009end\
- \009\009else\
- \009\009\009for y=minY,maxY,-1 do\
- \009\009\009\009drawPixelInternal( target, math.floor( x + 0.5 ), y )\
- \009\009\009\009x = x - dx\
- \009\009\009end\
- \009\009end\
- \009end\
- end\
- \
- local function drawRect(target, x1, y1, x2, y2, nColour)\
- \009for i = 0, y2 - 1 do\
- \009\009drawLine(target, x1, y1 + i, x1 + x2 - 1, y1 + i, nColour)\
- \009end\
- end\
- -------------------------------------------------------------------------------------------\
- ---End of custom drawing API\
- -------------------------------------------------------------------------------------------\
- local peripheralPool = {}\
- local SELECTED_OBJECT = nil\
- local backupPullEvent = nil\
- -------------------------------------------------------------------------------------------\
- ---PUBLIC GUI API\
- -------------------------------------------------------------------------------------------\
- function SET_SELECTED_OBJECT(OBJ)\
- \009SELECTED_OBJECT = OBJ\
- end\
- \
- function CLEAR_SCREEN(color, target)\
- \009if not target then target = term.native() end\
- \009target.setBackgroundColor(color)\
- \009target.clear()\
- end\
- \
- function NO_EXIT()\
- \009os.pullEvent(\"GUI_USER_EXIT\")\
- \009cleanup(MainPanel)\
- end\
- \
- function EXIT()\
- \009os.queueEvent(\"GUI_USER_EXIT\")\
- end\
- \
- local function cleanup(object)\
- \009for _, child in pairs(object._CHILDREN) do\
- \009\009cleanup(child)\
- \009\009child = nil\
- \009end\
- end\
- \
- local function getPeripheralName(p)\
- \009return peripheralPool[p]\
- end\
- \
- function connectPeripheral(name)\
- \009local p = peripheral.wrap(name)\
- \009peripheralPool[p] = name\
- \009return p\
- end\
- \
- local function getTextLayoutPos(layout, text, x, y, width, height, px, py)\
- \009if layout == \"topleft\" then\
- \009\009return x, y\
- \009elseif layout == \"top\" then\
- \009\009local cx = x + math.floor( ( width - string.len(text) ) / 2)\
- \009\009return cx, y\
- \009elseif layout == \"topright\" then\
- \009\009local cx = x + ( width - string.len(text) ) + 1\
- \009\009return cx, y\
- \009elseif layout == \"center\" then\
- \009\009local cy = y + math.floor(height / 2)\
- \009\009local cx = x + math.floor( ( width - string.len(text) ) / 2)\
- \009\009return cx, cy\009\
- \009elseif layout == \"left\" then\
- \009\009local cy = y + math.floor(height / 2)\
- \009\009return x, cy\009\
- \009elseif layout == \"right\" then\
- \009\009local cx = x +( width - string.len(text) ) + 1\
- \009\009local cy = y + math.floor(height / 2) \
- \009\009return cx, cy\
- \009elseif layout == \"bottomleft\" then\
- \009\009local cy = y + math.floor(height / 2) + 1\
- \009\009return x, cy\
- \009elseif layout == \"bottom\" then\
- \009\009local cx = x + math.floor( ( width - string.len(text) ) / 2)\
- \009\009local cy = y + math.floor(height / 2) + 1\
- \009\009return cx, cy\
- \009elseif layout == \"bottomright\" then\
- \009\009local cx = x +( width - string.len(text) ) + 1\
- \009\009local cy = y + math.floor(height / 2) + 1\
- \009\009return cx, cy\
- \009end\
- end\
- \
- local function inBounds(x, y, x1, y1, w, h)\
- \009if ( ( x >= x1 and x <= ( x1 + w) ) and (y >= y1 and y <= ( y1 + h ) ) ) then\
- \009\009return true\
- \009end\
- \009return false\
- end\
- \
- --Defaults for all objects\
- local function getDefaults()\
- \009local mt = {\
- \009\009target = term.native(),\
- \009\009x = 1,\
- \009\009y = 1,\
- \009\009dynX = 1,\
- \009\009dynY = 1,\
- \009\009width = 1,\
- \009\009height = 1,\
- \009\009enabled = true,\
- \009\009visible = true,\
- \009\009text = \"\",\
- \009\009func = nil,\
- \009\009text_pos = \"center\",\
- \009\009color_text = colors.white,\
- \009\009color_bg = colors.blue,\
- \009\009color_used = colors.red,\
- \009\009_PARENT = nil,\
- \009\009_CHILDREN = {},\
- \009\009\
- \009\009addPARENT = function(s, object)\
- \009\009\009s._PARENT = object\
- \009\009end,\
- \009\009\
- \009\009addCHILD = function(s, object) end,\
- \009\009\
- \009\009enable = function(s)\
- \009\009\009s.enabled = true\
- \009\009end,\
- \009\009\
- \009\009disable = function(s)\
- \009\009\009s.enabled = false\
- \009\009end,\
- \009\009\
- \009\009show = function(s)\
- \009\009\009s.visible = true\
- \009\009end,\
- \009\009\
- \009\009showNDraw = function(s)\
- \009\009\009s:show()\
- \009\009\009s:draw()\
- \009\009end,\
- \009\009\
- \009\009showNDrawNEnable = function(s)\
- \009\009\009s:showNDraw()\
- \009\009\009s:enable()\
- \009\009end,\
- \009\009\
- \009\009hide = function(s)\
- \009\009\009s.visible = false\
- \009\009end,\
- \009\009\
- \009\009hideNDisable = function(s)\
- \009\009\009s:hide()\
- \009\009\009s:disable()\
- \009\009end,\
- \009\009\
- \009\009showNEnable = function(s)\
- \009\009\009s:showNDraw()\
- \009\009\009s:enable()\
- \009\009end,\
- \009\009\
- \009\009setText = function(s, t)\
- \009\009\009s.text = t\
- \009\009\009s:draw()\
- \009\009end,\
- \009\009\
- \009\009move = function(s, x, y)\
- \009\009\009s.x = x\
- \009\009\009s.y = y\
- \009\009\009s:_dynRefresh()\
- \009\009end,\
- \009\009\
- \009\009resize = function(s, w, h)\
- \009\009\009s.width = w\
- \009\009\009s.height = h\
- \009\009end,\
- \009\009\
- \009\009_dynRefresh = function(s)\
- \009\009\009px, py = 1, 1\
- \009\009\009if s._PARENT then\
- \009\009\009\009px, py = s._PARENT.dynX, s._PARENT.dynY\
- \009\009\009end\
- \009\009\009s.dynX = s.x + px - 1\
- \009\009\009s.dynY = s.y + py - 1\
- \009\009end,\
- \009\009\
- \009\009clickCheck = function(s) return false end,\
- \009\009draw = function(s) end,\
- \009\009eventReact = function(s, e) end,\
- \009\009\
- \009\009used = function(s)\
- \009\009\009if s.func then s:func() end\
- \009\009end\
- \009\009\
- \009}\
- \009return {__index = mt}\
- end\
- \
- --Panel constructor\
- function NewPanel(x, y, visible, enabled)\
- \009local panel = {\
- \009\009addCHILD = function(s, ...)\
- \009\009\009local args = {...}\
- \009\009\009for _, object in pairs(args) do\
- \009\009\009\009table.insert(s._CHILDREN, object)\
- \009\009\009\009object:addPARENT(s)\
- \009\009\009end\
- \009\009end,\
- \009\009\
- \009\009draw = function(s)\
- \009\009\009if not s.visible then return end\
- \009\009\009s:_dynRefresh()\
- \009\009\009for _, child in pairs(s._CHILDREN) do\
- \009\009\009\009child:draw()\
- \009\009\009end\
- \009\009end\
- \009}\
- \009panel = setmetatable(panel, getDefaults())\
- \009\
- \009panel.x = x\
- \009panel.y = y\
- \009panel.visible = visible\
- \009panel.enabled = enabled\
- \009\
- \009return panel\
- end\
- \
- --Button constructor\
- function NewButton(target, x, y, width, height, text, func, color_bg, color_text, color_used)\
- \009local button = {\
- \009\009draw = function(s, color)\
- \009\009\009if not s.visible then return end\
- \009\009\009if not color then color = s.color_bg end\
- \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
- \009\009\009\
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, s.height, color)\
- \009\009\009\
- \009\009\009local cx, cy = getTextLayoutPos(s.text_pos, s.text, s.dynX, s.dynY, s.width, s.height)\
- \009\009\009s.target.setTextColor(s.color_text)\
- \009\009\009s.target.setCursorPos(cx, cy)\
- \009\009\009s.target.write(s.text)\009\
- \009\009\009\009\
- \009\009\009s.target.setCursorPos(cursorX, cursorY)\
- \009\009end,\
- \009\009\
- \009\009clickCheck = function(s, t)\
- \009\009\009if not s.enabled then return end\
- \009\009\009\
- \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
- \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
- \009\009\009\009return \
- \009\009\009end\
- \
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
- \009\009\009\009s:used()\
- \009\009\009\009return true\
- \009\009\009end\
- \009\009\009return false\
- \009\009end,\
- \009}\
- \009button = setmetatable(button, getDefaults())\
- \009\
- \009button.target = target\
- \009button.x = x\
- \009button.y = y\
- \009button.width = width\
- \009button.height = height\
- \009button.text = text\
- \009button.func = func\
- \009button.color_text = color_text\
- \009button.color_bg = color_bg\
- \009button.color_used = color_used\
- \009\
- \009return button\
- end\
- \
- --CheckBox constructor\
- function NewCheckBox(target, x, y, width, height, text, func, color_bg, color_text, color_used)\
- \009local chbox = {\
- \009\009check = false, \
- \009\009\
- \009\009draw = function(s, color)\
- \009\009\009if not s.visible then return end\
- \009\009\009if not color then color = s.color_bg end\
- \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
- \009\009\009\
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, s.height, color)\
- \009\009\009\
- \009\009\009local cx, cy = getTextLayoutPos(s.text_pos, \"[ ]-\" .. s.text, s.dynX, s.dynY, s.width, s.height)\
- \009\009\009s.target.setTextColor(s.color_text)\
- \009\009\009s.target.setCursorPos(cx, cy)\
- \009\009\009s.target.write(\"[\"..( (s.check == true) and \"X\" or \" \") .. \"]-\"..s.text)\009\
- \009\009\009\009\
- \009\009\009s.target.setCursorPos(cursorX, cursorY)\
- \009\009end,\
- \009\009\
- \009\009clickCheck = function(s, t)\
- \009\009\009if not s.enabled then return end\
- \009\009\009\
- \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
- \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
- \009\009\009\009return \
- \009\009\009end\
- \
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
- \009\009\009\009s:used()\
- \009\009\009\009return true\
- \009\009\009end\
- \009\009\009return false\
- \009\009end,\
- \009\009\
- \009\009used = function(s)\
- \009\009\009s.check = not s.check\
- \009\009\009if s.func then s:func() end\
- \009\009\009s:draw()\
- \009\009end,\
- \009}\
- \009chbox = setmetatable(chbox, getDefaults())\
- \009\
- \009chbox.target = target\
- \009chbox.x = x\
- \009chbox.y = y\
- \009chbox.width = width\
- \009chbox.height = height\
- \009chbox.text = text\
- \009chbox.func = func\
- \009chbox.color_text = color_text\
- \009chbox.color_bg = color_bg\
- \009chbox.color_used = color_used\
- \009\
- \009return chbox\
- end\
- \
- --Progress Bar constructor\
- function NewProgressBar(target, x, y, width, height, color_bg, color_used)\
- \009local pbar = {\
- \009\009step = 0.01,\
- \009\009progress = 0.0,\
- \009\009\
- \009\009setProgress = function(s, np)\
- \009\009\009s.progress = (np > 1) and 1 or np\
- \009\009\009s:draw()\
- \009\009end,\
- \009\009\
- \009\009clear = function(s)\
- \009\009\009s.progress = 0\
- \009\009\009s:draw()\
- \009\009end,\
- \009\009\
- \009\009stepIt = function(s)\
- \009\009\009s.progress = s.progress + s.step\
- \009\009\009if s.progress > 1 then s.progress = 1 end\
- \009\009\009s:draw()\
- \009\009end,\
- \009\009\
- \009\009draw = function(s)\
- \009\009\009if not s.visible then return end\
- \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009local pos = s.width * s.progress\
- \009\009\009if pos < s.width then\
- \009\009\009\009drawRect(s.target, s.dynX + pos, s.dynY, s.width - pos, s.height, s.color_bg)\
- \009\009\009end\
- \009\009\009if pos > 0 and pos ~= s.width then\
- \009\009\009\009drawRect(s.target, s.dynX, s.dynY, pos+1, s.height, s.color_used)\
- \009\009\009end\
- \009\009\009\
- \009\009\009s.text = tostring( math.floor(s.progress * 100) )..\"%\"\
- \009\009\009\
- \009\009\009local cx, cy = getTextLayoutPos(s.text_pos, s.text, s.dynX, s.dynY, s.width, s.height)\
- \009\009\009s.target.setTextColor(s.color_text)\
- \009\009\009s.target.setCursorPos(cx, cy)\
- \009\009\009\
- \009\009\009if cx > s.dynX + pos then\
- \009\009\009\009s.target.setBackgroundColor(s.color_bg)\
- \009\009\009\009s.target.write(s.text)\009\
- \009\009\009else\
- \009\009\009\009s.target.write(string.sub(s.text, 1, math.floor(s.dynX + pos - cx + 1) ) )\
- \009\009\009\009s.target.setBackgroundColor(s.color_bg)\
- \009\009\009\009s.target.write(string.sub(s.text, math.floor(s.dynX + pos - cx + 2), #s.text))\
- \009\009\009end\
- \009\009\009\
- \009\009\009s.target.setCursorPos(cursorX, cursorY)\
- \009\009end,\
- \009}\
- \009pbar = setmetatable(pbar, getDefaults())\
- \009pbar.target = target\
- \009pbar.x = x\
- \009pbar.y = y\
- \009pbar.width = width\
- \009pbar.height = height\
- \009pbar.color_bg = color_bg\
- \009pbar.color_used = color_used\
- \009\
- \009return pbar\
- end\
- \
- function NewTextLine(target, x, y, width, text, func, color_bg, color_text)\
- \009local textline = {\
- \009\009secure = false,\
- \009\009_textpos = 1,\
- \009\009_cursorpos = 1,\
- \009\009\
- \009\009draw = function(s)\
- \009\009\009if not s.visible then return end\
- \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
- \009\009\009\
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, 1, s.color_bg)\
- \
- \009\009\009s.target.setTextColor(s.color_text)\
- \009\009\009s.target.setCursorPos(s.dynX, s.dynY)\
- \009\009\009local temp = string.sub(s.text, s._textpos, s._textpos + s.width)\
- \009\009\009if s.secure then\
- \009\009\009\009for i = 1, #temp do\
- \009\009\009\009\009s.target.write(\"*\")\
- \009\009\009\009end\
- \009\009\009else\
- \009\009\009\009s.target.write(temp)\
- \009\009\009end\
- \009\009\009\009\
- \009\009\009s.target.setCursorPos(cursorX, cursorY)\
- \009\009end,\
- \009\009\
- \009\009clickCheck = function(s, t)\
- \009\009\009if not s.enabled then return end\
- \009\009\009\
- \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
- \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
- \009\009\009\009return \
- \009\009\009end\
- \
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
- \009\009\009\009SELECTED_OBJECT = s\
- \009\009\009\009return true\
- \009\009\009end\
- \009\009\009return false\
- \009\009end,\
- \009\009\
- \009\009eventReact = function(s, e)\
- \009\009\009if not s.enabled then return end\
- \009\009\009if e[1] == \"key\" then\
- \009\009\009\009if e[2] == 28 then\
- \009\009\009\009\009SELECTED_OBJECT = nil\
- \009\009\009\009\009s:used()\
- \009\009\009\009elseif e[2] == 14 then\
- \009\009\009\009\009s.text = string.sub(s.text, 1, #s.text - 1)\
- \009\009\009\009\009s._cursorpos = s._cursorpos - 1\
- \009\009\009\009\009\
- \009\009\009\009\009if s._cursorpos <= s._textpos then\
- \009\009\009\009\009\009s._textpos = s._textpos - 4\
- \009\009\009\009\009end\
- \009\009\009\009\009if s._textpos < 1 then\
- \009\009\009\009\009\009s._textpos = 1\
- \009\009\009\009\009end\
- \009\009\009\009\009if s._cursorpos < 1 then\
- \009\009\009\009\009\009s._cursorpos = 1\
- \009\009\009\009\009end\
- \009\009\009\009\009\
- \009\009\009\009\009s:draw()\
- \009\009\009\009elseif e[2] == 203 then\
- \009\009\009\009--left\
- \009\009\009\009elseif e[2] == 205 then\
- \009\009\009\009--right\
- \009\009\009\009end\
- \009\009\009elseif e[1] == \"char\" then\
- \009\009\009\009s.text = s.text .. e[2] --testing\
- \009\009\009\009\
- \009\009\009\009s._cursorpos = s._cursorpos + 1\
- \009\009\009\009\
- \009\009\009\009if s._cursorpos > s._textpos + s.width - 1 then\
- \009\009\009\009\009s._textpos = s._textpos + 1\
- \009\009\009\009end\
- \009\009\009\009\
- \009\009\009\009s:draw()\
- \009\009\009end\
- \009\009end,\
- \009}\
- \009textline = setmetatable(textline, getDefaults())\
- \009textline.target = target\
- \009textline.x = x\
- \009textline.y = y\
- \009textline.width = width\
- \009textline.text = text\
- \009textline.func = func\
- \009textline.color_bg = color_bg\
- \009textline.color_text = color_text\
- \009return textline\
- end\
- \
- --TextArea constructor\
- function NewTextArea(target, x, y, width, height, text, color_bg, color_text)\
- \009local textarea = {\
- \009\009draw = function(s)\
- \009\009\009if not s.visible then return end\
- \009\009\009local cursorX, cursorY = s.target.t()\
- \009\009\009\
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, s.height, s.color_bg)\
- \009\009\009\
- \009\009\009local k = 0\
- \009\009\009for i = 1, string.len(s.text), s.width do\
- \009\009\009\009s.target.setCursorPos(s.dynX, s.dynY + k)\
- \009\009\009\009k = k + 1\
- \009\009\009\009s.target.setTextColor(s.color_text)\
- \009\009\009\009s.target.write(string.sub(s.text, i, i + s.width - 1))\
- \009\009\009end\
- \009\009\009\009\
- \009\009\009s.target.setCursorPos(cursorX, cursorY)\
- \009\009end,\
- \009\009\
- \009\009clickCheck = function(s, t)\
- \009\009\009if not s.enabled then return end\
- \009\009\009\
- \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
- \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
- \009\009\009\009return \
- \009\009\009end\
- \
- \009\009\009s:_dynRefresh()\
- \009\009\009\
- \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
- \009\009\009\009SELECTED_OBJECT = s\
- \009\009\009\009return true\
- \009\009\009end\
- \009\009\009return false\
- \009\009end,\
- \009\009\
- \009\009eventReact = function(s, e)\
- \009\009\009if not s.enabled then return end\
- \009\009\009if e[1] == \"key\" then\
- \009\009\009\009if e[2] == 28 then\
- \009\009\009\009\009--testing\
- \009\009\009\009elseif e[2] == 14 then\
- \009\009\009\009\009s.text = string.sub(s.text, 1, #s.text - 1)\
- \009\009\009\009\009s:draw()\
- \009\009\009\009end\
- \009\009\009elseif e[1] == \"char\" then\
- \009\009\009\009s.text = s.text .. e[2] --testing\
- \009\009\009\009s:draw()\
- \009\009\009end\
- \009\009end,\
- \009}\
- \009textarea = setmetatable(textarea, getDefaults())\
- \009textarea.target = target\
- \009textarea.x = x\
- \009textarea.y = y\
- \009textarea.width = width\
- \009textarea.height = height\
- \009textarea.text = text\
- \009textarea.color_bg = color_bg\
- \009textarea.color_text = color_text\
- \009return textarea\
- end\
- \
- --Label constructor\
- function NewLabel(target, x, y, text, color_bg, color_text)\
- \009local label = {\
- \009\009draw = function(s)\
- \009\009\009if not s.visible then return end\
- \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
- \009\009\009\
- \009\009\009s:_dynRefresh()\
- \009\
- \009\009\009drawLine(s.target, s.dynX, s.dynY, s.dynX + string.len(s.text) - 1, s.dynY , s.color_bg)\
- \009\009\009s.target.setTextColor(s.color_text)\
- \009\009\009s.target.setCursorPos(s.dynX, s.dynY)\
- \009\009\009s.target.write(s.text)\
- \009\009\009\
- \009\009\009s.target.setCursorPos(cursorX, cursorY)\
- \009\009end,\
- \009}\
- \009label = setmetatable(label, getDefaults())\
- \009label.target = target\
- \009label.x = x\
- \009label.y = y\
- \009label.text = text\
- \009label.color_bg = color_bg\
- \009label.color_text = color_text\
- \009return label\
- end\
- \
- --click/touch handler\
- local function exec(event, object)\
- \009if not object.enabled then return end\
- \009for _, child in pairs(object._CHILDREN) do\
- \009\009exec(event, child)\
- \009\009if child:clickCheck(event) then\
- \009\009\009return true\
- \009\009end\
- \009end\
- end\
- \
- MainPanel = NewPanel()\
- \
- --Event handler. Call this if overwrite os.pullEvent()\
- function eventHandler(e)\
- \009if e[1] == \"mouse_click\" or e[1] == \"monitor_touch\" then\
- \009\009--Check if selected object or its children clicked\
- \009\009if SELECTED_OBJECT then\
- \009\009\009exec(e, SELECTED_OBJECT)\
- \009\009end\
- \009\009SELECTED_OBJECT = nil\
- \009\009exec(e, MainPanel)\
- \009elseif e[1] == \"key\" or e[1] == \"char\"then\
- \009\009if SELECTED_OBJECT then\
- \009\009\009SELECTED_OBJECT:eventReact(e)\
- \009\009end\
- \009end\
- end\
- \
- backupPullEvent = os.pullEvent\
- \
- function os.pullEvent()\
- \009local e = { os.pullEventRaw() }\
- \009eventHandler(e)\
- \009return e[1], e[2], e[3], e[4], e[5]\
- end",
- },
- time = "time()",
- },
- FileSystem = {
- folders = {},
- },
- Config = {
- [ "clog.cfg" ] = "AlexZfelf",
- [ "pas.cfg" ] = "MICROZ",
- [ "user.cfg" ] = "NEW",
- [ "log.cfg" ] = "KURWA@",
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement