Advertisement
aidenmagrath

Main Menu

Aug 6th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.99 KB | None | 0 0
  1. os.loadAPI("GraphicsAPI")
  2. mon = peripheral.wrap("left")
  3.  
  4. term.redirect(mon)
  5.  
  6. GraphicsAPI.resetSurface()
  7. GraphicsAPI.resetScreen()
  8.  
  9. screenWidth, screenHeight = term.getSize()
  10. print("X:" ..x .." Y:" .. y)
  11. tileX = math.floor(screenWidth / 8)
  12. tileY = math.floor(screenHeight / 5)
  13.  
  14. print("tileX:" ..tileX .." tileY:" ..tileY)
  15.  
  16. topMenu = {
  17.   {name = "back", text = "", x = 1, y = 1, width = tileX, height = tileY, color = colors.red},
  18.   {name = "title", text = "", x = tileX + 1, y = 1, width = tileX * 6, height = tileY, color = colors.blue},
  19.   {name = "next", text = "", x = tileX * 7 + 1, y = 1, width = tileX, height = tileY, color = colors.red},
  20.   {name = "a", text = "A", x = 1, y = tileY + 1, width = tileX, height = tileY, color = colors.green},
  21.   {name = "b", text = "B", x = tileX * 2 + 1, y = tileY + 1, width = tileX, height = tileY, color = colors.cyan},
  22.   {name = "c", text = "C", x = tileX * 3 + 1, y = tileY + 1, width = tileX, height = tileY, color = colors.green},
  23.   {name = "d", text = "D", x = tileX * 4 + 1, y = tileY + 1, width = tileX, height = tileY, color = colors.cyan},
  24.  -- {name = "e", text = "E", x = tileX * 5 + 1, y = tileY + 1, width = tileX, height = tileY, color = colors.green},
  25. --  {name = "f", text = "F", x = tileX * 6 + 1, y = tileY + 1, width = tileX, height = tileY, color = colors.cyan},
  26.  -- {name = "g", text = "G", x = tileX * 7 + 1, y = tileY + 1, width = tileX, height = tileY, color = colors.green},
  27.  -- {name = "h", text = "H", x = tileX * 8 + 1, y = tileY + 1, width = tileX, height = tileY, color = colors.cyan}
  28. }
  29.  
  30. for i=1, #topMenu do
  31.   GraphicsAPI.drawRect({topMenu[i]["x"], topMenu[i]["y"]}, {topMenu[i]["x"] + topMenu[i]["width"], topMenu[i]["y"] + topMenu[i]["height"]}, topMenu[i]["color"], topMenu[i]["color"])
  32. end
  33.  
  34. --GraphicsAPI.drawRect({1, 1}, {9, 6}, colors.red, colors.red)
  35. --GraphicsAPI.drawRect({10, 1}, {73, 6}, colors.blue, colors.blue)
  36. --GraphicsAPI.drawRect({74, 1}, {82, 6}, colors.red, colors.red)
  37. term.restore();
  38. GraphicsAPI.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement