You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
619 B
33 lines
619 B
package mightypork.gamecore.app;
|
|
|
|
|
|
import mightypork.gamecore.eventbus.BusEvent;
|
|
import mightypork.gamecore.eventbus.event_flags.SingleReceiverEvent;
|
|
|
|
|
|
/**
|
|
* Request to execute given {@link Runnable} in main loop.
|
|
*
|
|
* @author MightyPork
|
|
*/
|
|
@SingleReceiverEvent
|
|
public class MainLoopRequest extends BusEvent<MainLoopRequestListener> {
|
|
|
|
private final Runnable task;
|
|
|
|
|
|
/**
|
|
* @param task task to run on main thread in rendering context
|
|
*/
|
|
public MainLoopRequest(Runnable task)
|
|
{
|
|
this.task = task;
|
|
}
|
|
|
|
|
|
@Override
|
|
public void handleBy(MainLoopRequestListener handler)
|
|
{
|
|
handler.queueTask(task);
|
|
}
|
|
}
|
|
|