public class LibgdxTaskExecutor extends java.lang.Object implements TaskExecutor
Constructor and Description |
---|
LibgdxTaskExecutor(int threads) |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
void |
execute(java.lang.Runnable runnable)
Queues a
Runnable instance to be run on a separate thread |
void |
setMaxFrameTasksPerFrame(int max)
Sets the maximum number of
FrameSpreadTask instances to update per frame |
<T> AsyncResult<T> |
submit(java.util.concurrent.Callable<T> callable)
Submits a
Callable instance to be executed on a separate thread |
void |
submit(FrameSpreadTask task)
Submits a
FrameSpreadTask to be completed over several frames |
AsyncFuture |
submit(java.lang.Runnable runnable)
Submits a
Runnable instance to be executed on a separate thread |
void |
update(float delta)
Updates
FrameSpreadTask instances each frame. |
public void update(float delta)
TaskExecutor
FrameSpreadTask
instances each frame.
Note: This is called by mini2Dx and should not be called manually.update
in interface TaskExecutor
delta
- The game delta timepublic void execute(java.lang.Runnable runnable)
TaskExecutor
Runnable
instance to be run on a separate threadexecute
in interface TaskExecutor
runnable
- The task to run on a separate threadpublic AsyncFuture submit(java.lang.Runnable runnable)
TaskExecutor
Runnable
instance to be executed on a separate threadsubmit
in interface TaskExecutor
runnable
- The task to run on a separate threadAsyncFuture
instance that can be checked for task completionpublic <T> AsyncResult<T> submit(java.util.concurrent.Callable<T> callable)
TaskExecutor
Callable
instance to be executed on a separate threadsubmit
in interface TaskExecutor
T
- The return typecallable
- The task to run on a separate threadAsyncResult
instance that can be checked for task completionpublic void submit(FrameSpreadTask task)
TaskExecutor
FrameSpreadTask
to be completed over several framessubmit
in interface TaskExecutor
task
- The FrameSpreadTask
to executepublic void setMaxFrameTasksPerFrame(int max)
TaskExecutor
FrameSpreadTask
instances to update per framesetMaxFrameTasksPerFrame
in interface TaskExecutor
max
- The maximum number greater than 0public void dispose()
dispose
in interface org.mini2Dx.gdx.utils.Disposable