Limit UPS to 1000

This commit is contained in:
Rin 2021-08-20 21:38:58 +01:00
parent 49b39259e5
commit 8bdd067978
2 changed files with 18 additions and 11 deletions

View File

@ -1 +1 @@
version = "v0.3-beta6-nrs"
version = "v0.3-beta6"

View File

@ -291,6 +291,7 @@ function love.resize(w, h)
end
local TARGET_FPS = 60
local TARGET_UPS = 1000
--[[
-- OLD RUN CODE BELOW
@ -361,11 +362,20 @@ function love.run()
if love.timer then love.timer.step() end
local u_tacc = 0
local tacc = 0
local start_time = love.timer.getTime()
return function()
local ut = love.timer.getTime()
runsystem.updatedelta = ut - start_time
if love.event then
u_tacc = u_tacc + runsystem.updatedelta
if u_tacc >= 1 / TARGET_UPS then
runsystem.updatefps = 1 / u_tacc
u_tacc = 0
love.event.pump()
for n, a, b, c, d, e, f in love.event.poll() do
if n == 'quit' then
@ -376,15 +386,12 @@ function love.run()
love.handlers[n](a, b, c, d, e, f)
end
end
end
if love.timer then
processBGMFadeout(love.timer.step())
end
local ut = love.timer.getTime()
runsystem.updatedelta = ut - start_time
runsystem.updatefps = 1 / (ut - start_time)
if scene and scene.update and love.timer then
local delta = ut - start_time
start_time = ut