diff --git a/GamePlay/Actions/Attack.java b/GamePlay/Actions/Attack.java new file mode 100644 index 0000000..5a3bbb9 --- /dev/null +++ b/GamePlay/Actions/Attack.java @@ -0,0 +1,5 @@ +package Actions; + +public class Attack { + +} diff --git a/GamePlay/input/Button.java b/GamePlay/input/Button.java new file mode 100644 index 0000000..85a90c7 --- /dev/null +++ b/GamePlay/input/Button.java @@ -0,0 +1,19 @@ +package input; + +public enum Button { + UP, DOWN, LEFT, RIGHT, A, B, C, D; + + public int toInt() { + switch (this) { + case UP : return 0; + case DOWN : return 1; + case LEFT : return 2; + case RIGHT : return 3; + case A : return 4; + case B : return 5; + case C : return 6; + case D : return 7; + default : return -1; + } + } +} diff --git a/GamePlay/input/InputBuffer.java b/GamePlay/input/InputBuffer.java index 32e51fe..570eabd 100644 --- a/GamePlay/input/InputBuffer.java +++ b/GamePlay/input/InputBuffer.java @@ -2,7 +2,6 @@ package input; public class InputBuffer { - private static final int numberOfInputs = 8; private static final Boolean[] baseInputs = {false,false,false,false,false,false,false,false}; /** diff --git a/GamePlay/input/Input_Attack.java b/GamePlay/input/Input_Attack.java deleted file mode 100644 index c61661f..0000000 --- a/GamePlay/input/Input_Attack.java +++ /dev/null @@ -1,11 +0,0 @@ -package input; - -import java.util.ArrayList; - -public class Input_Attack { - /* - * The list of all input needed to make an attack - */ - //public ArrayList input_list; - -} diff --git a/GamePlay/input/Inputs.java b/GamePlay/input/Inputs.java new file mode 100644 index 0000000..c34934f --- /dev/null +++ b/GamePlay/input/Inputs.java @@ -0,0 +1,45 @@ +package input; + +/** + * The class handling the parsing of one input. + * @author Victor + * + */ +public class Inputs { + private static final int numberOfInputs = 8; + private static boolean[] tab; + + public Inputs() { + this.tab = new boolean[numberOfInputs]; + for(int i = 0; i < numberOfInputs; i ++) { + this.tab[i] = false; + } + } + + /** + * record one input + * @param i the integer value corresponding to the tab location + */ + public void recordOneInput(int i) { + try { + this.tab[i] = true; + } catch (ArrayIndexOutOfBoundsException e) { + //TODO : what do we do here ? Error message ? + } + } + + /** + * Check if a specific input (for example UP) has been recorded + * @param i the integer value corresponding to the input + * @return + */ + public boolean containsInput(Button b) { + return this.tab[b.toInt()]; + } + + public boolean[] getInputs() { + return this.tab; + } + + +}