mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 22:49:03 -06:00
Limit UPS to 1000
This commit is contained in:
parent
49b39259e5
commit
8bdd067978
@ -1 +1 @@
|
||||
version = "v0.3-beta6-nrs"
|
||||
version = "v0.3-beta6"
|
27
main.lua
27
main.lua
@ -291,6 +291,7 @@ function love.resize(w, h)
|
||||
end
|
||||
|
||||
local TARGET_FPS = 60
|
||||
local TARGET_UPS = 1000
|
||||
|
||||
--[[
|
||||
-- OLD RUN CODE BELOW
|
||||
@ -361,19 +362,29 @@ 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
|
||||
love.event.pump()
|
||||
for n, a, b, c, d, e, f in love.event.poll() do
|
||||
if n == 'quit' then
|
||||
if not love.quit or not love.quit() then
|
||||
return a or 0
|
||||
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
|
||||
if not love.quit or not love.quit() then
|
||||
return a or 0
|
||||
end
|
||||
end
|
||||
love.handlers[n](a, b, c, d, e, f)
|
||||
end
|
||||
love.handlers[n](a, b, c, d, e, f)
|
||||
end
|
||||
end
|
||||
|
||||
@ -381,10 +392,6 @@ function love.run()
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user