Package playn.core
Class Platform
java.lang.Object
playn.core.Platform
- Direct Known Subclasses:
StubPlatform
Provides access to all PlayN cross-platform services.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumDefines the lifecycle events.static enumEnumerates the supported platform types. -
Field Summary
FieldsModifier and TypeFieldDescriptionAny errors reported viareportError(java.lang.String, java.lang.Throwable)will be emitted to this signal in addition to being logged.This signal will be emitted at the start of every frame after the platform is started.A signal emitted with lifecycle events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Assetsassets()Returns theAssetsservice.abstract Audioaudio()Returns theAudioservice.<E> voiddispatchEvent(Signal<E> signal, E event) Dispatcheseventonsignaland catches any error that propagates out of the event dispatch, reporting it viareportError(java.lang.String, java.lang.Throwable).abstract Execexec()Returns theExecservice.abstract Graphicsgraphics()Returns theGraphicsservice.abstract Inputinput()Returns theInputservice.voidinvokeAsync(Runnable action) Deprecated.voidinvokeLater(Runnable runnable) Deprecated.booleanDeprecated.abstract Jsonjson()Returns theJsonservice.abstract Loglog()Returns theLogservice.abstract Netnet()Returns theNetservice.abstract voidOpens the given URL in the default browser.voidreportError(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.abstract Storagestorage()Returns theStoragestorage service.abstract inttick()Returns the number of milliseconds that have elapsed since the game started.abstract doubletime()Returns the current time, as a double value in millis since January 1, 1970, 00:00:00 GMT.abstract Platform.Typetype()Returns the platformPlatform.Type.
-
Field Details
-
lifecycle
A signal emitted with lifecycle events. -
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
Any errors reported viareportError(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
Returns the platformPlatform.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 JREnew Date().getTime();, but is terser and avoids the use oflong, 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
Opens the given URL in the default browser. -
assets
Returns theAssetsservice. -
audio
Returns theAudioservice. -
exec
Returns theExecservice. -
graphics
Returns theGraphicsservice. -
input
Returns theInputservice. -
json
Returns theJsonservice. -
log
Returns theLogservice. -
net
Returns theNetservice. -
storage
Returns theStoragestorage service. -
reportError
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
Dispatcheseventonsignaland catches any error that propagates out of the event dispatch, reporting it viareportError(java.lang.String, java.lang.Throwable). -
invokeLater
Deprecated. -
isAsyncSupported
Deprecated. -
invokeAsync
Deprecated.
-
Exec.invokeAsync(java.lang.Runnable).