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.
52 lines
862 B
52 lines
862 B
11 years ago
|
package mightypork.rogue.events;
|
||
11 years ago
|
|
||
|
|
||
11 years ago
|
import mightypork.gamecore.control.bus.events.Event;
|
||
|
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent;
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* Request for a global sction to be done in the main loop.
|
||
11 years ago
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
11 years ago
|
@SingleReceiverEvent
|
||
11 years ago
|
public class ActionRequest implements Event<ActionRequest.Listener> {
|
||
11 years ago
|
|
||
11 years ago
|
private final RequestType type;
|
||
11 years ago
|
|
||
|
|
||
|
public ActionRequest(RequestType request) {
|
||
|
type = request;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public void handleBy(Listener handler)
|
||
|
{
|
||
|
handler.requestAction(type);
|
||
|
}
|
||
|
|
||
|
public interface Listener {
|
||
|
|
||
11 years ago
|
/**
|
||
|
* Perform the requested action
|
||
|
*
|
||
|
* @param request
|
||
|
*/
|
||
11 years ago
|
void requestAction(RequestType request);
|
||
11 years ago
|
}
|
||
|
|
||
11 years ago
|
|
||
|
@Override
|
||
|
public String toString()
|
||
|
{
|
||
|
return "ActionRequest(" + type + ")";
|
||
|
}
|
||
|
|
||
11 years ago
|
public static enum RequestType
|
||
|
{
|
||
|
FULLSCREEN, SCREENSHOT, SHUTDOWN;
|
||
|
}
|
||
11 years ago
|
}
|