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.

46 lines
1.0 KiB

package visualiser.gameController.Keys;
import javafx.scene.input.KeyCode;
/**
* Key for the controller, part of the abstract factory KeyFactory
*/
public abstract class ControlKey {
private String name;
private KeyCode keyCode;
/**
* Constructor for Control
* @param name name of the key
* @param keyCode key code for the key
*/
public ControlKey(String name, KeyCode keyCode){
this.name = name;
this.keyCode = keyCode;
}
/**
* To String method
* @return returns the name of the key
*/
public String toString(){
return this.name;
}
/**
* What this key should do when the command is issued for it to do its job.
*/
public abstract void onAction();//may want to make it take in a visualiser and stuff in the future.
/**
* What to do when the key is held
*/
public abstract void onHold();
/**
* What to do when the key is released.
*/
public abstract void onRelease();
}