diff --git a/load/version.lua b/load/version.lua index 0e5b04a..f722ac9 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3-beta6-nrs" \ No newline at end of file +version = "v0.3-beta6" \ No newline at end of file diff --git a/main.lua b/main.lua index 61d61b5..a322c6d 100644 --- a/main.lua +++ b/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