Guest User

Untitled

a guest
Feb 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. recording = 0
  2. recordfps = 60
  3. recordframes = 0
  4. recordft = ".avi"
  5. recorduiseen = 0
  6. recorduitype = 0
  7. if package.config:sub(1,1) == "\\" then
  8. recordds = "\\"
  9. else
  10. recordds = "/"
  11. end
  12.  
  13. uix = (612 / 2) - (146 / 2)
  14. uiy = (384 / 2) - (58 / 2)
  15.  
  16. function tpt.recordsui()
  17. tpt.fillrect(612,32,16,16)
  18. tpt.drawtext(618,37,"S",0,0,0)
  19. recordframes = recordframes + 1
  20. tpt.drawtext(5,385,tostring(math.floor(recordframes / 60)) .. "s")
  21. end
  22.  
  23. function tpt.recordui()
  24. if recorduiseen == 1 then
  25. tpt.fillrect(uix,uiy,146,58,0,0,0)
  26. tpt.drawrect(uix,uiy,146,58)
  27. tpt.drawrect(uix + 107, uiy + 2, 37, 12)
  28. if recorduitype == 0 then
  29. tpt.drawtext(uix + 109, uiy + 5, "Options")
  30. tpt.drawrect(uix + 2, uiy + 2, 12, 12)
  31. tpt.drawrect(uix + 54, uiy + 2, 12, 12)
  32.  
  33. if recordft == ".avi" then
  34. tpt.fillrect(uix + 3, uiy + 3, 10, 10, 0, 255, 0)
  35. tpt.fillrect(uix + 55, uiy + 3, 10, 10, 0, 63, 0)
  36. else
  37. tpt.fillrect(uix + 3, uiy + 3, 10, 10, 0, 63, 0)
  38. tpt.fillrect(uix + 55, uiy + 3, 10, 10, 0, 255, 0)
  39. end
  40. tpt.drawrect(uix + 2, uiy + 16, 70, 12)
  41. tpt.drawrect(uix + 74, uiy + 16, 70, 12)
  42. tpt.drawrect(uix + 2, uiy + 30, 70, 12)
  43. tpt.drawrect(uix + 74, uiy + 30, 70, 12)
  44. tpt.drawrect(uix + 2, uiy + 44, 142, 12)
  45. tpt.drawtext(uix + 16, uiy + 5, "AVI Out")
  46. tpt.drawtext(uix + 68, uiy + 5, "GIF Out")
  47.  
  48. tpt.drawtext(uix + 9, uiy + 18, "Clean folder")
  49. tpt.drawtext(uix + 76, uiy + 18, "Start recording")
  50. tpt.drawtext(uix + 13, uiy + 32, "Select AVI")
  51. tpt.drawtext(uix + 85, uiy + 32, "Select GIF")
  52. tpt.drawtext(287, uiy + 47, "CREATE!")
  53. else
  54. tpt.drawtext(uix + 115, uiy + 5, "Main")
  55. tpt.drawrect(uix + 25, uiy + 16, 12, 12)
  56. tpt.drawrect(uix + 39, uiy + 16, 19, 12)
  57. tpt.drawrect(uix + 60, uiy + 16, 12, 12)
  58. tpt.drawtext(uix + 2, uiy + 18, "FPS:")
  59. tpt.drawline(uix + 28, uiy + 22, uix + 34, uiy + 22)
  60. tpt.drawtext(uix + (48 - (tpt.textwidth(tostring(recordfps)) / 2)), uiy + 19, tostring(recordfps))
  61. tpt.drawline(uix + 63, uiy + 22, uix + 69, uiy + 22)
  62. tpt.drawline(uix + 66, uiy + 19, uix + 66, uiy + 25)
  63. end
  64. end
  65. tpt.drawrect(613,33,14,14)
  66. tpt.drawtext(618,37,"S")
  67. end
  68.  
  69. function tpt.recordmouse(x,y,b,e)
  70. if recording == 1 and x > 612 and y > 32 and x < 629 and y < 48 and b == 1 and e == 1 then
  71. tpt.unregister_step(tpt.recordsui)
  72. tpt.unregister_step(tpt.screenshot)
  73. tpt.register_step(tpt.recordui)
  74. tpt.set_pause(1)
  75. recording = 0
  76. recorduiseen = 1
  77. elseif recording == 0 and x > 612 and y > 32 and x < 629 and y < 48 and b == 1 and e == 1 then
  78. recorduiseen = math.mod(recorduiseen + 1, 2)
  79. tpt.set_pause(recorduiseen)
  80. end
  81. if x > uix + 106 and y > uiy + 1 and x < uix + 148 and y < uiy + 15 and b == 1 and e == 1 then
  82. recorduitype = math.mod(recorduitype + 1, 2)
  83. end
  84. if b == 1 and e == 1 and recorduiseen == 1 and recorduitype == 0 then
  85. if x > uix + 1 and y > uiy + 15 and x < uix + 73 and y < uiy + 29 then
  86. if recordds == "\\" then
  87. os.execute("del *.ppm")
  88. else
  89. os.execute("rm *.ppm")
  90. end
  91. elseif x > uix + 73 and y > uiy + 15 and x < uix + 145 and y < uiy + 29 then
  92. tpt.unregister_step(tpt.recordui)
  93. tpt.register_step(tpt.recordsui)
  94. tpt.register_step(tpt.screenshot)
  95. tpt.set_pause(0)
  96. recording = 1
  97. recorduiseen = 0
  98. elseif x > uix + 1 and y > uiy + 29 and x < uix + 73 and y < uiy + 43 then
  99. recordft = ".avi"
  100. elseif x > uix + 73 and y > uiy + 29 and x < uix + 145 and y < uiy + 43 then
  101. recordft = ".gif"
  102. elseif x > uix + 1 and y > uiy + 43 and x < uix + 145 and y < uiy + 57 then
  103. videocount = 1
  104. while io.open("Videos" .. recordds .. "tptvideo" .. string.format("%04d",videocount) .. recordft, "rb") ~= nil do
  105. videocount = videocount + 1
  106. end
  107. os.execute("ffmpeg -r " .. tostring(recordfps) .. " -sameq -i frame%04d.ppm Videos" .. recordds .. "tptvideo" .. string.format("%04d",videocount).. recordft)
  108. end
  109. elseif b == 1 and e == 1 and recorduiseen == 1 and recorduitype == 1 then
  110. if x > uix + 24 and y > uiy + 15 and x < uix + 38 and y < uiy + 29 then
  111. if recordfps > 1 then recordfps = recordfps - 1 end
  112. elseif x > uix + 59 and y > uiy + 15 and x < uix + 73 and y < uiy + 29 then
  113. if recordfps < 60 then recordfps = recordfps + 1 end
  114. end
  115. end
  116. end
  117.  
  118. tpt.register_step(tpt.recordui)
  119. tpt.register_mouseclick(tpt.recordmouse)
Add Comment
Please, Sign In to add comment