Advertisement
VdanielV

SAPK

Apr 17th, 2021 (edited)
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. WIFI = peripheral.wrap("back")
  2. function tlok()
  3.     tlo = paintutils.loadImage("/aplikacje/SAPK/background.nfp")
  4.     paintutils.drawImage(tlo, 1, 1)
  5.     term.setCursorPos(1,1)
  6.     term.setBackgroundColor(colors.blue)
  7.     term.setTextColor(colors.white)
  8.     io.write("SAPK - Application")
  9.     term.setCursorPos(26,1)
  10.     io.write("X")
  11.     term.setCursorPos(7,4)
  12.     term.setBackgroundColor(colors.lightGray)
  13.     io.write("Otworz wejscie")
  14.     term.setCursorPos(1,1)
  15.     term.setTextColor(colors.black)
  16.     term.setBackgroundColor(colors.white)
  17. end
  18. tlok()
  19. while true do
  20.     local event, button, x, y = os.pullEvent( "mouse_click" )
  21.     if (button==1) and (x>=6) and (x<=21) and (y>=3) and (y<=4) then
  22.         term.setCursorPos(1,1)
  23.         term.clear()
  24.         io.write("Podaj haslo: ")
  25.         haslo = io.read()
  26.         WIFI.transmit(50, 1, haslo)
  27.         tlok()
  28.     elseif (button==1) and (x==26) and (y==1) then
  29.         term.setBackgroundColor(colors.black)
  30.         term.setCursorPos(1,1)
  31.         term.clear()
  32.         term.setTextColor(colors.yellow)
  33.         print(os.version())
  34.         term.setTextColor(colors.white)
  35.         break
  36.     elseif (button==2) and (x>=6) and (x<=21) and (y>=3) and (y<=4) then
  37.         WIFI.transmit(50, 1, "testEthernet")
  38.     elseif (button==1) and (x>=6) and (x<=9) and (y>=7) and (y<=9) then
  39.         WIFI.transmit(50, 1, "swiatlaWejscieWlacz")
  40.     elseif (button==1) and (x>=18) and (x<=21) and (y>=7) and (y<=9) then
  41.         WIFI.transmit(50, 1, "swiatlaWejscieWylacz")
  42.     end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement