Advertisement
WriteEscape

Untitled

Dec 30th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. local component = require( "component" )
  2. local gpu = component.gpu
  3. local event = require( "event" )
  4. local filesystem = require("filesystem")
  5. local oldW, oldH = gpu.getResolution()
  6. gpu.setResolution( 160, 50 )
  7.  
  8. local artofmana = 0
  9. local braderz = 0
  10. local english = 0
  11. local write = 0
  12.  
  13.  
  14. function clearScreen()
  15. local oldColor = gpu.getBackground( false )
  16. local w,h = gpu.getResolution()
  17. gpu.setBackground( 0x000000, false )
  18. gpu.fill( 1, 1, w, h, " " )
  19. gpu.setBackground( oldColor, false )
  20. end
  21.  
  22. function progressBar( label, y, value, maxVal, color, show, unit )
  23. local oldColor = gpu.getBackground( false )
  24. gpu.setBackground(0x000000, false)
  25. gpu.fill( 3, y, 75, 2, " " )
  26. w = math.floor( value * (75 / maxVal) )
  27. p = math.floor( (w / 75) * 100 )
  28. gpu.set( 3, y, label .. ": " .. tostring( p ) .. "%" )
  29. gpu.setBackground( 0x222222, false )
  30. gpu.fill( 3, y+1, 75, 1, " " )
  31. gpu.setBackground( color, false )
  32. gpu.fill( 3, y+1, w, 1, " " )
  33. gpu.setBackground( oldColor, false )
  34. if show then
  35. local valStr = formatBig( value ) .. unit
  36. local n = string.len( valStr )
  37. gpu.set( 78 - n, y, valStr )
  38. end
  39. end
  40.  
  41. clearScreen()
  42. local max = 10000
  43. local cur = 0
  44.  
  45. while true do
  46. local _,_,x,y = event.pull( 1, "touch" )
  47. if x and y then goto quit end
  48.  
  49. progressBar( "ArtofMana", 2, artofmana, 15, 0xff0000, false, "Points" )
  50. progressBar( "BraderzBuilds", 5, braderz, 15, 0xff0000, false, "Points" )
  51. progressBar( "EnglishMystery", 8, english, 15, 0xff0000, false, "Points" )
  52. progressBar( "WriteEscape", 11, write, 15, 0xff0000, false, "Points" )
  53.  
  54.  
  55. os.sleep(0.25)
  56. end
  57.  
  58.  
  59. ::quit::
  60. gpu.setResolution( oldW, oldH )
  61. clearScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement