mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
fix: curtime
This commit is contained in:
parent
3bb44ccbc0
commit
6699c9f4ae
|
@ -3,14 +3,9 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
local StreamsRequeted = false
|
local StreamsRequeted = false
|
||||||
local LastFrame = 0
|
|
||||||
|
|
||||||
hook.Add("PostRender", "gmInte:PostRender:Stream:Frame", function()
|
hook.Add("PostRender", "gmInte:PostRender:Stream:Frame", function()
|
||||||
if (!StreamsRequeted) then return end
|
if (!StreamsRequeted) then return end
|
||||||
|
StreamsRequeted = false
|
||||||
// Limit frame rate
|
|
||||||
if (LastFrame > CurTime()) then return end
|
|
||||||
LastFrame = CurTime() + 0.25
|
|
||||||
|
|
||||||
// Capture frame
|
// Capture frame
|
||||||
local captureConfig = {
|
local captureConfig = {
|
||||||
|
@ -19,7 +14,7 @@ hook.Add("PostRender", "gmInte:PostRender:Stream:Frame", function()
|
||||||
y = 0,
|
y = 0,
|
||||||
w = ScrW(),
|
w = ScrW(),
|
||||||
h = ScrH(),
|
h = ScrH(),
|
||||||
quality = 50,
|
quality = 30,
|
||||||
}
|
}
|
||||||
|
|
||||||
local screenCapture = render.Capture(captureConfig)
|
local screenCapture = render.Capture(captureConfig)
|
||||||
|
@ -43,36 +38,20 @@ hook.Add("PostRender", "gmInte:PostRender:Stream:Frame", function()
|
||||||
gmInte.log("Failed to send frame to WebPanel", true)
|
gmInte.log("Failed to send frame to WebPanel", true)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
StreamsRequeted = false
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- //
|
local Steam = false
|
||||||
-- // Methods
|
timer.Create("gmInte:Stream:Frame", 0.5, 0, function()
|
||||||
-- //
|
if (Steam) then
|
||||||
|
StreamsRequeted = true
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- function gmInte.takeScreenShot(serverID, authToken)
|
//
|
||||||
-- gmInte.config.id = serverID
|
// Console Commands
|
||||||
-- gmInte.config.token = authToken
|
//
|
||||||
-- StreamsRequeted = true
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- function gmInte.stopScreenShot()
|
concommand.Add("gmod_integration_stream", function()
|
||||||
-- StreamsRequeted = false
|
Steam = !Steam
|
||||||
-- end
|
gmInte.log("Streaming frames to WebPanel: " .. tostring(Steam))
|
||||||
|
end)
|
||||||
-- //
|
|
||||||
-- // Console Commands
|
|
||||||
-- //
|
|
||||||
|
|
||||||
-- concommand.Add("gmod_integration_stream", function()
|
|
||||||
-- StreamsRequeted = !StreamsRequeted
|
|
||||||
-- gmInte.log("Streaming frames to WebPanel: " .. tostring(StreamsRequeted))
|
|
||||||
|
|
||||||
-- -- if (StreamsRequeted) then
|
|
||||||
-- -- gmInte.stopScreenShot()
|
|
||||||
-- -- gmInte.log("Stopped streaming frames to WebPanel")
|
|
||||||
-- -- else
|
|
||||||
-- -- gmInte.SendNet("getSingleUseToken")
|
|
||||||
-- -- gmInte.log("Started streaming frames to WebPanel")
|
|
||||||
-- -- end
|
|
||||||
-- end)
|
|
Loading…
Reference in New Issue
Block a user