57 lines
1.1 KiB
Java
57 lines
1.1 KiB
Java
package electrosphere.controls;
|
|
|
|
public class Control {
|
|
boolean isKey;
|
|
boolean isMouse;
|
|
boolean state;
|
|
int keyValue;
|
|
ControlMethod onPress;
|
|
ControlMethod onRelease;
|
|
ControlMethod onRepeat;
|
|
|
|
public boolean isIsKey() {
|
|
return isKey;
|
|
}
|
|
|
|
public boolean isIsMouse() {
|
|
return isMouse;
|
|
}
|
|
|
|
public boolean isState() {
|
|
return state;
|
|
}
|
|
|
|
public int getKeyValue() {
|
|
return keyValue;
|
|
}
|
|
|
|
public void setState(boolean state) {
|
|
this.state = state;
|
|
}
|
|
|
|
public Control(boolean isKey, boolean isMouse, int keyValue) {
|
|
this.isKey = isKey;
|
|
this.isMouse = isMouse;
|
|
this.keyValue = keyValue;
|
|
this.state = false;
|
|
}
|
|
|
|
public void setOnPress(ControlMethod method){
|
|
onPress = method;
|
|
}
|
|
|
|
public void setOnRelease(ControlMethod method){
|
|
onRelease = method;
|
|
}
|
|
|
|
public void setOnRepeat(ControlMethod method){
|
|
onRepeat = method;
|
|
}
|
|
|
|
|
|
public interface ControlMethod {
|
|
public void execute();
|
|
}
|
|
|
|
}
|