Advertisement
HawkPB

Untitled

Aug 1st, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. --filax
  2. local component=require("component")
  3. local gpu=component.gpu
  4. local shell=require("shell")
  5. local event=require"event"
  6.  
  7. local width,height=gpu.getResolution()
  8. local kill=false
  9. function clearScreen()
  10. gpu.fill(1,1,width,height," ")
  11. end
  12. function setbg(c) gpu.setBackground(c) end
  13. function setfg(c) gpu.setForeground(c) end
  14.  
  15. function drawTopBar(color,title)
  16. setbg(color)
  17. gpu.fill(1,1,width,1," ")
  18. setbg(0xFF0000)
  19. setfg(0xFFFFFF)
  20. gpu.set(width,1,"x")
  21. gpu.set(width/2-string.len(title)/2,1,title)
  22. event.listen("touch",function(_,x,y)
  23. if(x==width and y==1) then
  24. kill=true
  25. end
  26. end)
  27. end
  28. function rgbToHex(r, g, b)
  29. r = math.min(255, math.max(0, r))
  30. g = math.min(255, math.max(0, g))
  31. b = math.min(255, math.max(0, b))
  32. local hexR = string.format("%02X", r)
  33. local hexG = string.format("%02X", g)
  34. local hexB = string.format("%02X", b)
  35. return "#" .. hexR .. hexG .. hexB
  36. end
  37.  
  38.  
  39. clearScreen()
  40. drawTopBar(0x787878,"Filax")
  41.  
  42. while true do
  43. if exit then
  44. clearScreen()
  45. break
  46. end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement