Class: GameLoop

GameLoop()

new GameLoop()

Manages the main game loop, calling update and render functions at a consistent rate.
Source:

Methods

setRender(newRenderFunction)

Sets a new render function for the game loop.
Parameters:
Name Type Description
newRenderFunction function The new function to call for rendering the game.
Source:

setUpdate(newUpdateFunction)

Sets a new update function for the game loop.
Parameters:
Name Type Description
newUpdateFunction function The new function to call for game logic updates.
Source:

start()

Starts the game loop. Logs a warning if the loop is already running.
Source:

stop()

Stops the game loop.
Source:

GameLoop(update, render)

new GameLoop(update, render)

Creates an instance of GameLoop.
Parameters:
Name Type Description
update function The function to call for game logic updates. It receives deltaTime in seconds.
render function The function to call for rendering the game.
Source:

Methods

setRender(newRenderFunction)

Sets a new render function for the game loop.
Parameters:
Name Type Description
newRenderFunction function The new function to call for rendering the game.
Source:

setUpdate(newUpdateFunction)

Sets a new update function for the game loop.
Parameters:
Name Type Description
newUpdateFunction function The new function to call for game logic updates.
Source:

start()

Starts the game loop. Logs a warning if the loop is already running.
Source:

stop()

Stops the game loop.
Source: