Advertisement
tima_gt

tde-view 3.4-alpha

Aug 19th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. local function exit()
  2. term.setBackgroundColor(colors.black)
  3. term.clear()
  4. term.setCursorPos(1, 1)
  5. end
  6. term.setBackgroundColor(colors.white)
  7. term.setTextColor(colors.blue)
  8. term.clear()
  9. term.setCursorPos(18, 1)
  10. term.setBackgroundColor(colors.lightBlue)
  11. term.setCursorPos(1, 1)
  12. write('X')
  13. term.setBackgroundColor(colors.white)
  14. term.setCursorPos(18, 1)
  15. write('TDE VIWER 1.0')
  16. term.setCursorPos(4, 5)
  17. stri = 5
  18. i = 1
  19. while i <= 100 do
  20. if fs.exists('/photos/photo'..i) then
  21. if i % 5 == 0 then
  22. term.setCursorPos(4, stri + 2)
  23. stri = stri + 2
  24. write('photo'..i..'   ')
  25. else
  26. write('photo'..i..'   ')
  27. end
  28. end
  29. i = i + 1
  30. end
  31. term.setCursorPos(3, stri + 2)
  32. write('number of photo>')
  33. while true do
  34. local event, button, X, Y = os.pullEventRaw()
  35. if event == 'mouse_click' then
  36. if (Y == stri + 2) then
  37. photo = read()
  38. if (photo == '') or (photo == 'exit') or (tonumber(photo) > 100) then
  39. exit()
  40. break
  41. end
  42. if fs.exists('/photos/photo'..photo) then
  43. image = paintutils.loadImage('/photos/photo'..photo)
  44. file = fs.open('/photos/photo'..photo, 'r')
  45. a = file.readLine()
  46. file.close()
  47. a = string.len(a)
  48. if a < 56 then
  49. paintutils.drawImage(image, 2, 3)
  50. else
  51. paintutils.drawImage(image, 1, 3)
  52. end
  53. x, y = term.getCursorPos()
  54. term.setCursorPos(1, y + 1)
  55. term.setBackgroundColor(colors.white)
  56. write('photo loaded!')
  57. while true do
  58. local event, button, X, Y = os.pullEventRaw()
  59. if event == 'mouse_click' then
  60. if X == 1 and Y == 1 then
  61. break
  62. end
  63. end
  64. end
  65. end
  66. exit()
  67. break
  68. elseif X == 1 and Y == 1 then
  69. exit()
  70. break
  71. end
  72. end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement