handle close request per state

This commit is contained in:
yugecin
2017-01-11 23:04:50 +01:00
parent 4ba32c44f2
commit 66ee2a0979
6 changed files with 26 additions and 1 deletions

View File

@@ -19,6 +19,11 @@ package yugecin.opsudance.core.state;
public abstract class BaseOpsuState implements OpsuState {
@Override
public boolean onCloseRequest() {
return true;
}
@Override
public boolean keyPressed(int key, char c) {
return false;

View File

@@ -27,6 +27,11 @@ public interface OpsuState {
void enter();
void leave();
/**
* @return true if closing is allowed
*/
boolean onCloseRequest();
/**
* @return false to stop event bubbling
*/

View File

@@ -71,4 +71,9 @@ public abstract class TransitionState extends BaseOpsuState {
listener.onFinish();
}
@Override
public boolean onCloseRequest() {
return false;
}
}