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

51 lines
862 B

package mightypork.rogue.events;
import mightypork.gamecore.control.bus.events.Event;
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent;
/**
* Request for a global sction to be done in the main loop.
*
* @author MightyPork
*/
@SingleReceiverEvent
public class ActionRequest implements Event<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;
}
}