IClockBridge
interface IClockBridge
Extends: IBridge
Known subtypes: ManualClockBridge, SystemClockBridge
Package: dev.joid.lib.bridge.clock · Module: core · Source: IClockBridge.java
The bridge that gives JOID the time read by animations, tweens, media and drags.
Description
Section titled “Description”BridgeHandler.CLOCK holds a SystemClockBridge by default; a host whose time can pause, or a test, registers its own above it.
This clock follows the time of a game, which stops while the game pauses:
public final class EngineClockBridge implements IClockBridge {
private final Engine engine;
public EngineClockBridge(final Engine engine) { this.engine = engine; }
@Override public long nanoTime() { return this.engine.getGameNanos(); }
@Override public long currentTimeMillis() { return this.engine.getGameNanos() / 1_000_000L; }
}Full file: EngineClockBridge.java
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
long | nanoTime() abstract | Returns the current time in nanoseconds, from any origin, at the same rate as currentTimeMillis(); JOID uses only differences of it. |
long | currentTimeMillis() abstract | Returns the current time in milliseconds, which JOID reads as a date or as the phase of a cycle (Clock bridge). |
Method details
Section titled “Method details”nanoTime
Section titled “nanoTime”long nanoTime() abstract
Returns the current time in nanoseconds, from any origin, at the same rate as currentTimeMillis(); JOID uses only differences of it.
currentTimeMillis
Section titled “currentTimeMillis”long currentTimeMillis() abstract
Returns the current time in milliseconds, which JOID reads as a date or as the phase of a cycle (Clock bridge).
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
