public interface GameInterface
Modifier and Type | Method and Description |
---|---|
AsyncQueue |
getAsyncQueue()
Returns the AsyncQueue instance used by this game implementation
|
boolean |
isMainThread()
Determines if the current thread is the main thread or not.
|
default void |
postAsync(Runnable run)
Execute the runnable off of the main thread
|
void |
postToMain(Runnable run)
Schedule a runnable to run on the main thread
|
void |
registerShutdownHandler(TaskChainFactory factory)
Every factory created needs to register a way to automatically shut itself down (On Disable)
If its impossible to provide automatic shutdown registry, you should leave this method blank
and manually call
TaskChainFactory.shutdown(int, TimeUnit) |
void |
scheduleTask(int gameUnits,
Runnable run)
Schedule a task within the games scheduler using its own units
IMPLEMENTATION SPECIFIC
|
default void |
scheduleTask(int duration,
TimeUnit units,
Runnable run)
Adds a delay to the chain execution based on real time
Method will be ran async from main thread.
|
boolean isMainThread()
AsyncQueue getAsyncQueue()
void postToMain(Runnable run)
run
- default void postAsync(Runnable run)
run
- void scheduleTask(int gameUnits, Runnable run)
gameUnits
- run
- void registerShutdownHandler(TaskChainFactory factory)
TaskChainFactory.shutdown(int, TimeUnit)
factory
- Factory to shutdowndefault void scheduleTask(int duration, TimeUnit units, Runnable run)
TaskChain.abort()
if the delay is interrupted.duration
- Duration to delayunits
- Units to delay inrun
- Callback to execute once the delay is done.Copyright © 2018. All rights reserved.