Package playn.core

Class Platform

java.lang.Object
playn.core.Platform
Direct Known Subclasses:
StubPlatform

public abstract class Platform extends Object
Provides access to all PlayN cross-platform services.
  • Field Details

    • lifecycle

      public Signal<Platform.Lifecycle> lifecycle
      A signal emitted with lifecycle events.
    • frame

      public Signal<Platform> frame
      This signal will be emitted at the start of every frame after the platform is started. Games should connect to it to drive their main loop.
    • errors

      public Signal<Platform.Error> errors
      Any errors reported via reportError(java.lang.String, java.lang.Throwable) will be emitted to this signal in addition to being logged. Games can connect to this signal if they wish to capture and record platform errors.
  • Constructor Details

    • Platform

      public Platform()
  • Method Details

    • type

      public abstract Platform.Type type()
      Returns the platform Platform.Type.
    • time

      public abstract double time()
      Returns the current time, as a double value in millis since January 1, 1970, 00:00:00 GMT. This is equivalent to the standard JRE new Date().getTime();, but is terser and avoids the use of long, which is best avoided when translating to JavaScript.
    • tick

      public abstract int tick()
      Returns the number of milliseconds that have elapsed since the game started.
    • openURL

      public abstract void openURL(String url)
      Opens the given URL in the default browser.
    • assets

      public abstract Assets assets()
      Returns the Assets service.
    • audio

      public abstract Audio audio()
      Returns the Audio service.
    • exec

      public abstract Exec exec()
      Returns the Exec service.
    • graphics

      public abstract Graphics graphics()
      Returns the Graphics service.
    • input

      public abstract Input input()
      Returns the Input service.
    • json

      public abstract Json json()
      Returns the Json service.
    • log

      public abstract Log log()
      Returns the Log service.
    • net

      public abstract Net net()
      Returns the Net service.
    • storage

      public abstract Storage storage()
      Returns the Storage storage service.
    • reportError

      public void reportError(String message, Throwable cause)
      Called when a backend (or other framework code) encounters an exception that it can recover from, but which it would like to report in some orderly fashion. NOTE: this method may be called from threads other than the main PlayN thread.
    • dispatchEvent

      public <E> void dispatchEvent(Signal<E> signal, E event)
      Dispatches event on signal and catches any error that propagates out of the event dispatch, reporting it via reportError(java.lang.String, java.lang.Throwable).
    • invokeLater

      @Deprecated public void invokeLater(Runnable runnable)
    • isAsyncSupported

      @Deprecated public boolean isAsyncSupported()
      Deprecated.
    • invokeAsync

      @Deprecated public void invokeAsync(Runnable action)