Advertisement
HawkPB

Untitled

Aug 1st, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 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. setfg(0xFFFFFF)
  18. gpu.fill(1,1,width,1," ")
  19. gpu.set(width/2-string.len(title)/2,1,title)
  20. setbg(0xFF0000)
  21. setfg(0xFFFFFF)
  22. gpu.set(width,1,"x")
  23. event.listen("touch",function(_,x,y)
  24. if(x==width and y==1) then
  25. kill=true
  26. end
  27. end)
  28. end
  29. function rgbToHex(r, g, b)
  30. r = math.min(255, math.max(0, r))
  31. g = math.min(255, math.max(0, g))
  32. b = math.min(255, math.max(0, b))
  33. local hexR = string.format("%02X", r)
  34. local hexG = string.format("%02X", g)
  35. local hexB = string.format("%02X", b)
  36. return "#" .. hexR .. hexG .. hexB
  37. end
  38.  
  39.  
  40. clearScreen()
  41. drawTopBar(0x787878,"Filax")
  42.  
  43. while true do
  44. if exit then
  45. clearScreen()
  46. break
  47. end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement