public abstract class Game
extends java.lang.Object
This implementation separates game processing into two phases: simulation and render. The
simulation phase takes place via update
and is called with a monotonoically increasing
timer at a fixed rate. The interpolation phase takes place via paint
and is called
every time the game is rendered to the display (which may be more frequently than the simulation
is updated). The render phase will generally interpolate the values computed in update
to provide smooth rendering based on lower-frequency simulation updates.
Modifier and Type | Field and Description |
---|---|
Signal<Clock> |
paint
A signal emitted on every frame.
|
Platform |
plat
The platform on which this game is running.
|
Signal<Clock> |
update
A signal emitted on every simulation update.
|
Constructor and Description |
---|
Game(Platform plat,
int updateRate)
Creates a clocked game with the desired simulation update rate, in ms.
|
Modifier and Type | Method and Description |
---|---|
void |
paint(Clock clock)
Called on every frame.
|
void |
update(Clock clock)
Called on every simulation update.
|
public final Platform plat
public Game(Platform plat, int updateRate)
public void update(Clock clock)
updateClock
signal, but you can override this method to change or augment this behavior.clock
- a clock configured with the update timing information.public void paint(Clock clock)
paintClock
signal, but you can override this method to change or augment this behavior.clock
- a clock configured with the frame timing information.Copyright © 2019. All Rights Reserved.