Advertisement
pepeknamornik

Pepdroll apis

Jun 17th, 2021 (edited)
2,246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.58 KB | None | 0 0
  1. verze = "21.1016.R3"
  2. w,h = term.getSize()
  3.  
  4. function loadLogo(obrazek, px, py)
  5.     for i=1, #obrazek do
  6.     local pic = paintutils.parseImage(obrazek[i])
  7.     paintutils.drawImage(pic, px, py-1+i)
  8.     end
  9. end
  10.  
  11. local function bgc(barvaP) term.setBackgroundColor(barvaP) end
  12. local function txc(barvaP) term.setTextColor(barvaP) end
  13. local function curs(xi,yi) term.setCursorPos(xi,yi) end
  14.  
  15. function loadingS(px, py, opak, cb, cf)
  16.     local pozy = {2, 1, 1, 2, 3, 4, 4, 3, 2, 1, 1, 2, 3, 4, 4, 3,}
  17.     local pozx = {1,2,3,4,4,3,2,1,1,2,3,4,4,3,2,1}
  18.     paintutils.drawFilledBox(px, py, px+4, py+4, cb)
  19.         for o=1, opak do
  20.             for i=1, 8 do
  21.             curs(pozx[i]+px, pozy[i]+py) bgc(cb) txc(cf) write(" ")
  22.             curs(pozx[i+1]+px, pozy[i+1]+py) bgc(cb) txc(cf) write("·")
  23.             curs(pozx[i+2]+px, pozy[i+2]+py) bgc(cb) txc(cf) write("·")
  24.             curs(pozx[i+3]+px, pozy[i+3]+py) txc(cf) write("·")
  25.             curs(pozx[i+4]+px, pozy[i+4]+py) bgc(cb) txc(cf) write("·")
  26.             curs(pozx[i+5]+px, pozy[i+5]+py) bgc(cb) txc(cf) write("·")
  27.             sleep(0.1)
  28.             end
  29.         end
  30.     paintutils.drawPixel(px, py, cb)
  31. end
  32.  
  33. iconApp = {
  34. " 3330333 ",
  35. " 3303033 ",
  36. " 3303033 ",
  37. " 3000003 ",
  38. " 3033303 "}
  39.  
  40. function dialog(bgc,txc, nadpis,dtext1,dtext2,autoclose)
  41.  
  42.     if nadpis == nil then nadpis = "" end
  43.     if dtext1 == nil then dtext1 = "" end
  44.     if dtext2 == nil then dtext2 = "" end
  45.     if autoclose == nil then autoclose = "close" end
  46.  
  47.     myWindow = window.create(term.current(),w/2-8,h/2-2,20,7)
  48.     myWindow.setBackgroundColor(colors.white)
  49.     myWindow.setTextColor(colors.white)
  50.     myWindow.clear()
  51.     myWindow.setBackgroundColor(colors.red)
  52.     myWindow.setCursorPos (20, 1)
  53.     myWindow.write"×"
  54.     myWindow.setCursorPos (1, 1)
  55.     myWindow.setBackgroundColor(bgc)
  56.     myWindow.setTextColor(txc)
  57.     myWindow.write("                   ")
  58.     myWindow.setCursorPos (2, 1)
  59.     myWindow.write(nadpis)
  60.     myWindow.setBackgroundColor(colors.white)
  61.     myWindow.setTextColor(colors.black)
  62.     myWindow.setCursorPos (2, 3)
  63.     myWindow.write(dtext1)
  64.     myWindow.setCursorPos (2, 4)
  65.     myWindow.write(dtext2)
  66.     myWindow.setTextColor(colors.black)
  67.     myWindow.setBackgroundColor(colors.lightGray)
  68.     myWindow.setCursorPos (9, 6)
  69.     myWindow.write" OK "
  70.    
  71.     if autoclose == "close" then sleep (1) return end
  72.    
  73.     if autoclose == "return" then return end
  74.  
  75.      while true do
  76.             local event, button, x, y = os.pullEvent("mouse_click")
  77.            
  78.             if event == "mouse_click" and x == math.floor(w/2+11) and  y == math.floor(h/2-2) and button == 1 then
  79.             return
  80.             elseif event == "mouse_click" and x >= math.floor(w/2) and x <= math.floor(w/2+3) and  y == math.floor(h/2+3) and button == 1 then
  81.             myWindow.setBackgroundColor(colors.gray)
  82.             myWindow.setCursorPos (9, 6)
  83.             myWindow.write" OK "
  84.             sleep(0.1)
  85.             return
  86.             end
  87.     end
  88.    
  89. end
  90.  
  91. --- nefunk?ní
  92. function Aplikace()
  93.     if fs.exists ("/C/system/Users/"..user.."/Registry/.menuColor") then BPozadi = (nastaveni.barva) Btext = (text.barva) CCM = true else CCM = false BPozadi = (colors.gray) Btext = (colors.white) end
  94.     local AppW = window.create(term.current(),18,h-12,5,5) AppW.setBackgroundColor(BPozadi) sleep(0.1)
  95.         AppW = window.create(term.current(),18,h-14,10,10) AppW.setBackgroundColor(BPozadi) sleep(0.1)
  96.         AppW = window.create(term.current(),18,2,w-18,h-2) AppW.setBackgroundColor(BPozadi) AppW.setTextColor(Btext) AppW.clear() sleep(0.1)
  97.         AppW.setCursorPos(2,1)
  98.         AppW.write("Application")
  99.         loadLogo(iconApp, 20, 4)
  100.  
  101.     while true do
  102.             local event, button, x, y = os.pullEvent("mouse_click")
  103.    
  104.                 if x >= 18 and x <= w-18 and y >= 2 and y >= h-2 and button == 1 then
  105.                
  106.                 else
  107.                 plocha()
  108.                 end
  109.                
  110.     end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement