public interface ILoop extends ILaunchable
ILoop
interface provide method for game loops that are publicly exposed.
A loop is an implementation that performs actions (e.g. physics, rendering, input processing, ...) and updates other IUpdatable
instances while the game is running.
IUpdateable
Modifier and Type | Method and Description |
---|---|
void |
attach(IUpdateable updatable)
Attaches the update method of the specified IUpdatable instance to be called
every tick.
|
void |
detach(IUpdateable updatable)
Detaches the specified instance from the game loop.
|
long |
getDeltaTime()
Gets the total time in milliseconds that passed since the last tick.
|
java.util.concurrent.locks.Lock |
getLock()
Returns a lock that can be used for actions that must be performed either within or independently of the loop.
|
double |
getProcessTime()
Gets the actual process time in milliseconds that was required during the last tick.
|
int |
getTickRate()
Gets the rate at which this loop performs its updates.
|
long |
getTicks()
Gets the total amount of ticks performed by this loop since it was started.
|
int |
getUpdatableCount()
Gets the amount of attached
IUpdatable instances of this loop. |
void |
setTickRate(int tickRate)
Sets the tickrate at which the loop performs its updates.
|
start, terminate
void attach(IUpdateable updatable)
updatable
- The instance that will be registered for the update event.void detach(IUpdateable updatable)
updatable
- The instance that will be unregistered for the update event.int getUpdatableCount()
IUpdatable
instances of this loop.long getTicks()
ILaunchable.start()
int getTickRate()
long getDeltaTime()
getProcessTime()
double getProcessTime()
getDeltaTime()
java.util.concurrent.locks.Lock getLock()
Lock
for this loop.void setTickRate(int tickRate)
tickRate
- The tickrate of the loop.