Package playn.core

Class Exec.Default

java.lang.Object
playn.core.Exec
playn.core.Exec.Default
Enclosing class:
Exec

public abstract static class Exec.Default extends Exec
A default exec implementation which processes invokeLater(java.lang.Runnable) via the frame tick.
  • Constructor Details

    • Default

      public Default(Platform plat)
  • Method Details

    • invokeNextFrame

      public void invokeNextFrame(Runnable action)
      Description copied from class: Exec
      Invokes action on the next Platform.frame signal. The default implementation listens to the frame signal at a very high priority so that invoke later actions will run before the game's normal callbacks. Note: if the game is paused, these actions will not run until it is unpaused and the next game frame is processed.
      Specified by:
      invokeNextFrame in class Exec
    • invokeLater

      public void invokeLater(Runnable action)
      Description copied from class: Exec
      Invokes action on the next Platform.frame signal or, if the game is paused, on the OS UI thread. Actions posted here will still be run in order and in a single threaded manner (like Exec.invokeNextFrame(java.lang.Runnable)), but they are not guaranteed to run on the game thread if the game is paused during the frame on which actions are posted.

      If you're deferring a graphics or (game) UI action, you should almost certainly use Exec.invokeNextFrame(java.lang.Runnable), but if you are deferring an action like saving data or initiating a network connection, you may wish to use invokeLater to ensure that those actions are completed even if the player happens to pause the game (by backgrounding the app on mobile, for example) immediately after they are queued up.

      Specified by:
      invokeLater in class Exec