Rogue: Savage Rats, a retro-themed dungeon crawler
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.
 
 
rogue-savage-rats/src/mightypork/rogue/events/ActionRequest.java

52 lines
861 B

package mightypork.rogue.events;
import mightypork.util.control.eventbus.BusEvent;
import mightypork.util.control.eventbus.events.flags.SingleReceiverEvent;
/**
* Request for a global sction to be done in the main loop.
*
* @author MightyPork
*/
@SingleReceiverEvent
public class ActionRequest extends BusEvent<ActionRequest.Listener> {
private final RequestType type;
public ActionRequest(RequestType request)
{
type = request;
}
@Override
public void handleBy(Listener handler)
{
handler.requestAction(type);
}
public interface Listener {
/**
* Perform the requested action
*
* @param request
*/
void requestAction(RequestType request);
}
@Override
public String toString()
{
return "ActionRequest(" + type + ")";
}
public static enum RequestType
{
FULLSCREEN, SCREENSHOT, SHUTDOWN;
}
}