input events

This commit is contained in:
yugecin
2017-01-10 12:43:05 +01:00
parent e05b675285
commit 6857393315
7 changed files with 226 additions and 47 deletions

View File

@@ -0,0 +1,47 @@
/*
* opsu!dance - fork of opsu! with cursordance auto
* Copyright (C) 2017 yugecin
*
* opsu!dance is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* opsu!dance is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
*/
package yugecin.opsudance.core.state;
public abstract class BaseOpsuState implements OpsuState {
@Override
public boolean keyPressed(int key, char c) {
return false;
}
@Override
public boolean keyReleased(int key, char c) {
return false;
}
@Override
public boolean mouseWheelMoved(int delta) {
return false;
}
@Override
public boolean mousePressed(int button, int x, int y) {
return false;
}
@Override
public boolean mouseReleased(int button, int x, int y) {
return false;
}
}

View File

@@ -26,4 +26,29 @@ public interface OpsuState {
void enter();
void leave();
/**
* @return false to stop event bubbling
*/
boolean keyPressed(int key, char c);
/**
* @return false to stop event bubbling
*/
boolean keyReleased(int key, char c);
/**
* @return false to stop event bubbling
*/
boolean mouseWheelMoved(int delta);
/**
* @return false to stop event bubbling
*/
boolean mousePressed(int button, int x, int y);
/**
* @return false to stop event bubbling
*/
boolean mouseReleased(int button, int x, int y);
}

View File

@@ -18,9 +18,10 @@
package yugecin.opsudance.core.state.transitions;
import org.newdawn.slick.Graphics;
import yugecin.opsudance.core.state.BaseOpsuState;
import yugecin.opsudance.core.state.OpsuState;
public abstract class TransitionState implements OpsuState {
public abstract class TransitionState extends BaseOpsuState {
protected OpsuState applicableState;