dynamicXblue

Disk Writer CC

Nov 15th, 2021 (edited)
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. local speaker = peripheral.find("speaker")
  2. local monitor = peripheral.find("monitor")
  3.  
  4. monitor.setTextScale(0.5)
  5.  
  6. local width, height = monitor.getSize()
  7. print(width, height)
  8. --Intended for 18x19 (36x38 textScale)
  9.  
  10. local wScale, hScale = math.max(width / 36, 0.5), math.max(height/38, 0.5)
  11. local oScale = math.min(wScale, hScale)
  12.  
  13. local nearestHeight = math.floor(width / 1.5, 0)
  14.  
  15. local xScale = 1 --width / nearestHeight
  16.  
  17. print(nearestHeight)
  18.  
  19. term.redirect(monitor)
  20.  
  21. local function drawPlayButton(x, y, even)
  22.  
  23.     if even then
  24.         x = math.floor(x)
  25.         paintutils.drawFilledBox(x-math.floor(math.floor(1 * wScale) * xScale), y-math.floor(1 * wScale), x+math.floor(math.floor(2 * wScale) * xScale), y+math.floor(1 * wScale), colors.white)
  26.     else
  27.         x = math.ceil(x)
  28.         paintutils.drawFilledBox(x-math.floor(math.floor(1 * wScale) * xScale), y-math.floor(1 * wScale), x+math.floor(math.floor(1 * wScale) * xScale), y+math.floor(1 * wScale), colors.white)
  29.     end
  30.    
  31.  
  32.     --paintutils.drawLine(x-2, y-4, x+2, y-4, colors.white)
  33.     --paintutils.drawLine(x-3, y-3, x+3, y-3, colors.white)
  34.     --paintutils.drawLine(x-4, y-2, x+4, y-2, colors.white)
  35.     --paintutils.drawLine(x-4, y-1, x+4, y-1, colors.white)
  36.  
  37.     --paintutils.drawLine(x-2, y+4, x+2, y+4, colors.white)
  38.     --paintutils.drawLine(x-3, y+3, x+3, y+3, colors.white)
  39.     --paintutils.drawLine(x-4, y+2, x+4, y+2, colors.white)
  40.     --paintutils.drawLine(x-4, y+1, x+4, y+1, colors.white)
  41. end
  42.  
  43. local function drawArrows(colour1, colour2)
  44.     monitor.setTextScale(0.5)
  45.  
  46.     --Arrow Left
  47.     paintutils.drawLine(2, 47, 11, 43, colour1)
  48.     paintutils.drawLine(2, 47, 11, 51, colour1)
  49.  
  50.     --Arrow Right
  51.     paintutils.drawLine(56, 47, 46, 43, colour2)
  52.     paintutils.drawLine(56, 47, 46, 51, colour2)
  53.  
  54. end
  55.  
  56. local function setUp()
  57.  
  58.    
  59.     monitor.setBackgroundColor(colors.black)
  60.     monitor.clear()
  61.  
  62.     drawPlayButton(width/2, height - 2 * math.floor(wScale), width%2 == 0)
  63.    
  64. end
  65.  
  66.  
  67. setUp()
  68.  
  69. speaker.playSound("minecraft:music_disc.pigstep")
Advertisement
Add Comment
Please, Sign In to add comment