mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-23 06:09:02 -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"
|
15
main.lua
15
main.lua
@ -291,6 +291,7 @@ function love.resize(w, h)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local TARGET_FPS = 60
|
local TARGET_FPS = 60
|
||||||
|
local TARGET_UPS = 1000
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
-- OLD RUN CODE BELOW
|
-- OLD RUN CODE BELOW
|
||||||
@ -361,11 +362,20 @@ function love.run()
|
|||||||
|
|
||||||
if love.timer then love.timer.step() end
|
if love.timer then love.timer.step() end
|
||||||
|
|
||||||
|
local u_tacc = 0
|
||||||
local tacc = 0
|
local tacc = 0
|
||||||
local start_time = love.timer.getTime()
|
local start_time = love.timer.getTime()
|
||||||
|
|
||||||
return function()
|
return function()
|
||||||
|
local ut = love.timer.getTime()
|
||||||
|
runsystem.updatedelta = ut - start_time
|
||||||
|
|
||||||
if love.event then
|
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()
|
love.event.pump()
|
||||||
for n, a, b, c, d, e, f in love.event.poll() do
|
for n, a, b, c, d, e, f in love.event.poll() do
|
||||||
if n == 'quit' then
|
if n == 'quit' then
|
||||||
@ -376,15 +386,12 @@ function love.run()
|
|||||||
love.handlers[n](a, b, c, d, e, f)
|
love.handlers[n](a, b, c, d, e, f)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if love.timer then
|
if love.timer then
|
||||||
processBGMFadeout(love.timer.step())
|
processBGMFadeout(love.timer.step())
|
||||||
end
|
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
|
if scene and scene.update and love.timer then
|
||||||
local delta = ut - start_time
|
local delta = ut - start_time
|
||||||
start_time = ut
|
start_time = ut
|
||||||
|
Loading…
Reference in New Issue
Block a user