Class FixedUpdateGameLoop

java.lang.Object
technology.sola.engine.core.GameLoop
technology.sola.engine.core.FixedUpdateGameLoop
All Implemented Interfaces:
Runnable

@NullMarked public class FixedUpdateGameLoop extends GameLoop
FixedUpdateGameLoop is a GameLoop implementation that runs an update method at desired target updates per second and renders whenever an update is available. If there is no update, then the thread running it will take a short rest.
  • Constructor Details

    • FixedUpdateGameLoop

      public FixedUpdateGameLoop(EventHub eventHub, Consumer<Float> updateMethod, Runnable renderMethod, int targetUpdatesPerSecond)
      Creates an instance of the game loop.
      Parameters:
      eventHub - the EventHub instance
      updateMethod - the update method to run at target updates per second
      renderMethod - the render method to run whenever there is an update
      targetUpdatesPerSecond - the target updates per second
  • Method Details

    • startLoop

      protected void startLoop()
      Description copied from class: GameLoop
      Called to start the main game loop.
      Specified by:
      startLoop in class GameLoop