Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- recording = 0
- recordfps = 60
- recordframes = 0
- recordft = ".avi"
- recorduiseen = 0
- recorduitype = 0
- if package.config:sub(1,1) == "\\" then
- recordds = "\\"
- else
- recordds = "/"
- end
- uix = (612 / 2) - (146 / 2)
- uiy = (384 / 2) - (58 / 2)
- function tpt.recordsui()
- tpt.fillrect(612,32,16,16)
- tpt.drawtext(618,37,"S",0,0,0)
- recordframes = recordframes + 1
- tpt.drawtext(5,385,tostring(math.floor(recordframes / 60)) .. "s")
- end
- function tpt.recordui()
- if recorduiseen == 1 then
- tpt.fillrect(uix,uiy,146,58,0,0,0)
- tpt.drawrect(uix,uiy,146,58)
- tpt.drawrect(uix + 107, uiy + 2, 37, 12)
- if recorduitype == 0 then
- tpt.drawtext(uix + 109, uiy + 5, "Options")
- tpt.drawrect(uix + 2, uiy + 2, 12, 12)
- tpt.drawrect(uix + 54, uiy + 2, 12, 12)
- if recordft == ".avi" then
- tpt.fillrect(uix + 3, uiy + 3, 10, 10, 0, 255, 0)
- tpt.fillrect(uix + 55, uiy + 3, 10, 10, 0, 63, 0)
- else
- tpt.fillrect(uix + 3, uiy + 3, 10, 10, 0, 63, 0)
- tpt.fillrect(uix + 55, uiy + 3, 10, 10, 0, 255, 0)
- end
- tpt.drawrect(uix + 2, uiy + 16, 70, 12)
- tpt.drawrect(uix + 74, uiy + 16, 70, 12)
- tpt.drawrect(uix + 2, uiy + 30, 70, 12)
- tpt.drawrect(uix + 74, uiy + 30, 70, 12)
- tpt.drawrect(uix + 2, uiy + 44, 142, 12)
- tpt.drawtext(uix + 16, uiy + 5, "AVI Out")
- tpt.drawtext(uix + 68, uiy + 5, "GIF Out")
- tpt.drawtext(uix + 9, uiy + 18, "Clean folder")
- tpt.drawtext(uix + 76, uiy + 18, "Start recording")
- tpt.drawtext(uix + 13, uiy + 32, "Select AVI")
- tpt.drawtext(uix + 85, uiy + 32, "Select GIF")
- tpt.drawtext(287, uiy + 47, "CREATE!")
- else
- tpt.drawtext(uix + 115, uiy + 5, "Main")
- tpt.drawrect(uix + 25, uiy + 16, 12, 12)
- tpt.drawrect(uix + 39, uiy + 16, 19, 12)
- tpt.drawrect(uix + 60, uiy + 16, 12, 12)
- tpt.drawtext(uix + 2, uiy + 18, "FPS:")
- tpt.drawline(uix + 28, uiy + 22, uix + 34, uiy + 22)
- tpt.drawtext(uix + (48 - (tpt.textwidth(tostring(recordfps)) / 2)), uiy + 19, tostring(recordfps))
- tpt.drawline(uix + 63, uiy + 22, uix + 69, uiy + 22)
- tpt.drawline(uix + 66, uiy + 19, uix + 66, uiy + 25)
- end
- end
- tpt.drawrect(613,33,14,14)
- tpt.drawtext(618,37,"S")
- end
- function tpt.recordmouse(x,y,b,e)
- if recording == 1 and x > 612 and y > 32 and x < 629 and y < 48 and b == 1 and e == 1 then
- tpt.unregister_step(tpt.recordsui)
- tpt.unregister_step(tpt.screenshot)
- tpt.register_step(tpt.recordui)
- tpt.set_pause(1)
- recording = 0
- recorduiseen = 1
- elseif recording == 0 and x > 612 and y > 32 and x < 629 and y < 48 and b == 1 and e == 1 then
- recorduiseen = math.mod(recorduiseen + 1, 2)
- tpt.set_pause(recorduiseen)
- end
- if x > uix + 106 and y > uiy + 1 and x < uix + 148 and y < uiy + 15 and b == 1 and e == 1 then
- recorduitype = math.mod(recorduitype + 1, 2)
- end
- if b == 1 and e == 1 and recorduiseen == 1 and recorduitype == 0 then
- if x > uix + 1 and y > uiy + 15 and x < uix + 73 and y < uiy + 29 then
- if recordds == "\\" then
- os.execute("del *.ppm")
- else
- os.execute("rm *.ppm")
- end
- elseif x > uix + 73 and y > uiy + 15 and x < uix + 145 and y < uiy + 29 then
- tpt.unregister_step(tpt.recordui)
- tpt.register_step(tpt.recordsui)
- tpt.register_step(tpt.screenshot)
- tpt.set_pause(0)
- recording = 1
- recorduiseen = 0
- elseif x > uix + 1 and y > uiy + 29 and x < uix + 73 and y < uiy + 43 then
- recordft = ".avi"
- elseif x > uix + 73 and y > uiy + 29 and x < uix + 145 and y < uiy + 43 then
- recordft = ".gif"
- elseif x > uix + 1 and y > uiy + 43 and x < uix + 145 and y < uiy + 57 then
- videocount = 1
- while io.open("Videos" .. recordds .. "tptvideo" .. string.format("%04d",videocount) .. recordft, "rb") ~= nil do
- videocount = videocount + 1
- end
- os.execute("ffmpeg -r " .. tostring(recordfps) .. " -sameq -i frame%04d.ppm Videos" .. recordds .. "tptvideo" .. string.format("%04d",videocount).. recordft)
- end
- elseif b == 1 and e == 1 and recorduiseen == 1 and recorduitype == 1 then
- if x > uix + 24 and y > uiy + 15 and x < uix + 38 and y < uiy + 29 then
- if recordfps > 1 then recordfps = recordfps - 1 end
- elseif x > uix + 59 and y > uiy + 15 and x < uix + 73 and y < uiy + 29 then
- if recordfps < 60 then recordfps = recordfps + 1 end
- end
- end
- end
- tpt.register_step(tpt.recordui)
- tpt.register_mouseclick(tpt.recordmouse)
Add Comment
Please, Sign In to add comment