mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 21:59:01 -06:00
Add GameMode:fastUpdate
This commit is contained in:
parent
33b69abbb8
commit
acad85f29e
6
main.lua
6
main.lua
@ -381,7 +381,13 @@ function love.run()
|
||||
|
||||
if u_tacc >= 1 / TARGET_UPS then
|
||||
runsystem.updatefps = 1 / u_tacc
|
||||
|
||||
if scene and scene.fastUpdate then
|
||||
scene:fastUpdate(u_tacc)
|
||||
end
|
||||
|
||||
u_tacc = 0
|
||||
|
||||
love.event.pump()
|
||||
for n, a, b, c, d, e, f in love.event.poll() do
|
||||
if n == 'quit' then
|
||||
|
@ -4,6 +4,7 @@ Scene = Object:extend()
|
||||
|
||||
function Scene:new() end
|
||||
function Scene:update() end
|
||||
function Scene:fastUpdate(dt) end -- Equivalent to GameMode:fastUpdate(dt)
|
||||
function Scene:render() end
|
||||
function Scene:onInputPress() end
|
||||
function Scene:onInputRelease() end
|
||||
|
@ -45,6 +45,10 @@ function GameScene:render()
|
||||
self.game:draw(self.paused)
|
||||
end
|
||||
|
||||
function GameScene:fastUpdate(d)
|
||||
self.game:fastUpdate(d) -- Propagate the fast updates
|
||||
end
|
||||
|
||||
function GameScene:onInputPress(e)
|
||||
if (
|
||||
self.game.game_over or self.game.completed
|
||||
|
@ -952,4 +952,11 @@ function GameMode:provideSettings()
|
||||
return {}
|
||||
end
|
||||
|
||||
-- This function is called on every love.event.poll
|
||||
-- aka up to the UPS specified in main.lua.
|
||||
-- By default this is 1000, so this function will run
|
||||
-- up to 1000 times per second! Don't do anything
|
||||
-- expensive in here, as this WILL slow the game down.
|
||||
function GameMode:fastUpdate(deltaTime) end
|
||||
|
||||
return GameMode
|
||||
|
Loading…
Reference in New Issue
Block a user