diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java
index d9705fa..b07aa43 100644
--- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java
@@ -92,24 +92,24 @@ public abstract class ButtonsEvent extends GenericEvent {
/** **************** BUTTONS Methods ***************** */
/* generic button functions */
- protected boolean buttonTest(short buttonBitsDefinition, short buttons) {
+ protected boolean buttonTest(int buttonBitsDefinition, int buttons) {
return (buttons & buttonBitsDefinition) == buttonBitsDefinition;
}
- protected boolean isButtonJustPressed(short buttonBitsDefinition) {
+ protected boolean isButtonJustPressed(int buttonBitsDefinition) {
return buttonTest(buttonBitsDefinition, buttonsJustPressed)
&& !isButtonHeld(buttonBitsDefinition);
}
- protected boolean isButtonJustReleased(short buttonBitsDefinition) {
+ protected boolean isButtonJustReleased(int buttonBitsDefinition) {
return buttonTest(buttonBitsDefinition, buttonsJustReleased);
}
- protected boolean isButtonHeld(short buttonBitsDefinition) {
+ protected boolean isButtonHeld(int buttonBitsDefinition) {
return buttonTest(buttonBitsDefinition, buttonsHeld);
}
- protected boolean isButtonPressed(short buttonBitsDefinition) {
+ protected boolean isButtonPressed(int buttonBitsDefinition) {
return isButtonHeld(buttonBitsDefinition)
|| isButtonJustPressed(buttonBitsDefinition);
}
diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java
new file mode 100644
index 0000000..347e27c
--- /dev/null
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java
@@ -0,0 +1,329 @@
+/* This file is part of WiiuseJ.
+ *
+ * WiiuseJ 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.
+ *
+ * WiiuseJ 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 WiiuseJ. If not, see .
+ */
+package wiiusej.wiiusejevents.physicalevents;
+
+/**
+ * Class which represents a buttons event from a Classic controller.
+ *
+ * @author guiguito
+ */
+public class ClassicControllerButtonsEvent extends ButtonsEvent{
+
+ private static short CLASSIC_CTRL_BUTTON_UP = 0x0001;
+ private static short CLASSIC_CTRL_BUTTON_LEFT = 0x0002;
+ private static short CLASSIC_CTRL_BUTTON_ZR = 0x0004;
+ private static short CLASSIC_CTRL_BUTTON_X = 0x0008;
+ private static short CLASSIC_CTRL_BUTTON_A = 0x0010;
+ private static short CLASSIC_CTRL_BUTTON_Y = 0x0020;
+ private static short CLASSIC_CTRL_BUTTON_B = 0x0040;
+ private static short CLASSIC_CTRL_BUTTON_ZL = 0x0080;
+ private static short CLASSIC_CTRL_BUTTON_FULL_R = 0x0200;
+ private static short CLASSIC_CTRL_BUTTON_PLUS = 0x0400;
+ private static short CLASSIC_CTRL_BUTTON_HOME = 0x0800;
+ private static short CLASSIC_CTRL_BUTTON_MINUS = 0x1000;
+ private static short CLASSIC_CTRL_BUTTON_FULL_L = 0x2000;
+ private static short CLASSIC_CTRL_BUTTON_DOWN = 0x4000;
+ private static int CLASSIC_CTRL_BUTTON_RIGHT = 0x8000;
+ private static int CLASSIC_CTRL_BUTTON_ALL = 0xFEFF;
+
+ /**
+ * Constructor of the classic controller buttons Event.
+ *
+ * @param id
+ * id of the wiimote.
+ * @param buttonsJustPressed
+ * buttons just pressed.
+ * @param buttonsJustReleased
+ * buttons just released.
+ * @param buttonsHeld
+ * buttons just pressed.
+ */
+ public ClassicControllerButtonsEvent(int id, short buttonsJustPressed,
+ short buttonsJustReleased, short buttonsHeld) {
+ super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld);
+ }
+
+ /* Button LEFT */
+
+ public boolean isButtonLeftJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_LEFT);
+ }
+
+ public boolean isButtonLeftJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_LEFT);
+ }
+
+ public boolean isButtonLeftHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_LEFT);
+ }
+
+ public boolean isButtonLeftPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_LEFT);
+ }
+
+ /* Button RIGHT */
+
+ public boolean isButtonRightJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_RIGHT);
+ }
+
+ public boolean isButtonRightJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_RIGHT);
+ }
+
+ public boolean isButtonRightHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_RIGHT);
+ }
+
+ public boolean isButtonRightPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_RIGHT);
+ }
+
+ /* Button UP */
+
+ public boolean isButtonUpJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_UP);
+ }
+
+ public boolean isButtonUpJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_UP);
+ }
+
+ public boolean isButtonUpHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_UP);
+ }
+
+ public boolean isButtonUpPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_UP);
+ }
+
+ /* Button DOWN */
+
+ public boolean isButtonDownJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_DOWN);
+ }
+
+ public boolean isButtonDownJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_DOWN);
+ }
+
+ public boolean isButtonDownHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_DOWN);
+ }
+
+ public boolean isButtonDownPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_DOWN);
+ }
+
+ /* Button A */
+
+ public boolean isButtonAJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_A);
+ }
+
+ public boolean isButtonAJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_A);
+ }
+
+ public boolean isButtonAHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_A);
+ }
+
+ public boolean isButtonAPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_A);
+ }
+
+ /* Button B */
+
+ public boolean isButtonBJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_B);
+ }
+
+ public boolean isButtonBJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_B);
+ }
+
+ public boolean isButtonBHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_B);
+ }
+
+ public boolean isButtonBPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_B);
+ }
+
+ /* Button X */
+
+ public boolean isButtonXJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_X);
+ }
+
+ public boolean isButtonXJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_X);
+ }
+
+ public boolean isButtonXHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_X);
+ }
+
+ public boolean isButtonXPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_X);
+ }
+
+ /* Button Y */
+
+ public boolean isButtonYJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_Y);
+ }
+
+ public boolean isButtonYJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_Y);
+ }
+
+ public boolean isButtonYHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_Y);
+ }
+
+ public boolean isButtonYPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_Y);
+ }
+
+ /* Button FullLeft */
+
+ public boolean isButtonFullLeftJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_L);
+ }
+
+ public boolean isButtonFullLeftJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_FULL_L);
+ }
+
+ public boolean isButtonFullLeftHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_FULL_L);
+ }
+
+ public boolean isButtonFullLeftPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_L);
+ }
+
+ /* Button FullRight */
+
+ public boolean isButtonFullRightJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_R);
+ }
+
+ public boolean isButtonFullRightJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_FULL_R);
+ }
+
+ public boolean isButtonFullRightHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_FULL_R);
+ }
+
+ public boolean isButtonFullRightPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_R);
+ }
+
+ /* Button Home */
+
+ public boolean isButtonHomeJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_HOME);
+ }
+
+ public boolean isButtonHomeJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_HOME);
+ }
+
+ public boolean isButtonHomeHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_HOME);
+ }
+
+ public boolean isButtonHomePressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_HOME);
+ }
+
+ /* Button Minus */
+
+ public boolean isButtonMinusJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_MINUS);
+ }
+
+ public boolean isButtonMinusJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_MINUS);
+ }
+
+ public boolean isButtonMinusHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_MINUS);
+ }
+
+ public boolean isButtonMinusPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_MINUS);
+ }
+
+ /* Button Plus */
+
+ public boolean isButtonPlusJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_PLUS);
+ }
+
+ public boolean isButtonPlusJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_PLUS);
+ }
+
+ public boolean isButtonPlusHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_PLUS);
+ }
+
+ public boolean isButtonPlusPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_PLUS);
+ }
+
+ /* Button ZL */
+
+ public boolean isButtonZLJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZL);
+ }
+
+ public boolean isButtonZLJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_ZL);
+ }
+
+ public boolean isButtonZLHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_ZL);
+ }
+
+ public boolean isButtonZLPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_ZL);
+ }
+
+ /* Button ZR */
+
+ public boolean isButtonZRJustPressed() {
+ return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZR);
+ }
+
+ public boolean isButtonZRJustReleased() {
+ return isButtonJustReleased(CLASSIC_CTRL_BUTTON_ZR);
+ }
+
+ public boolean isButtonZRHeld() {
+ return isButtonHeld(CLASSIC_CTRL_BUTTON_ZR);
+ }
+
+ public boolean isButtonZRPressed() {
+ return isButtonPressed(CLASSIC_CTRL_BUTTON_ZR);
+ }
+
+}
diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java
new file mode 100644
index 0000000..3474dc6
--- /dev/null
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java
@@ -0,0 +1,177 @@
+/**
+ * This file is part of WiiuseJ.
+ *
+ * WiiuseJ 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.
+ *
+ * WiiuseJ 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 WiiuseJ. If not, see .
+ */
+package wiiusej.wiiusejevents.physicalevents;
+
+/**
+ * This class represents the values from the classic controller and its events.
+ *
+ * @author guiguito
+ */
+public class ClassicControllerEvent extends ExpansionEvent {
+
+ private float rightShoulder;
+ private float leftShoulder;
+ private ClassicControllerButtonsEvent buttonsEvent;
+ private JoystickEvent classicControllerRightJoystickEvent;
+ private JoystickEvent classicControllerLeftJoystickEvent;
+
+ /**
+ * Constructor of ClassicControllerEvent.
+ *
+ * @param id
+ * id of the wiimote.
+ * @param buttonsJustPressed
+ * buttons just pressed.
+ * @param buttonsJustReleased
+ * buttons just released.
+ * @param buttonsHeld
+ * buttons just pressed.
+ * @param rightShoulder
+ * right shoulder button (range 0-1).
+ * @param leftShoulder
+ * left shoulder button (range 0-1).
+ * @param langle
+ * angle the left joystick is being held.
+ * @param lmagnitude
+ * magnitude of the left joystick (range 0-1).
+ * @param lmax1
+ * maximum left joystick value 1.
+ * @param lmax2
+ * maximum left joystick value 2.
+ * @param lmin1
+ * minimum left joystick value 1.
+ * @param lmin2
+ * minimum left joystick value 2.
+ * @param lcenter1
+ * center left joystick value 1.
+ * @param lcenter2
+ * center left joystick value 2.
+ * @param rangle
+ * angle the right joystick is being held.
+ * @param rmagnitude
+ * magnitude of the right joystick (range 0-1).
+ * @param rmax1
+ * maximum right joystick value 1.
+ * @param rmax2
+ * maximum right joystick value 2.
+ * @param rmin1
+ * minimum right joystick value 1.
+ * @param rmin2
+ * minimum right joystick value 2.
+ * @param rcenter1
+ * center right joystick value 1.
+ * @param rcenter2
+ * center right joystick value 2.
+ */
+ public ClassicControllerEvent(int id, short buttonsJustPressed,
+ short buttonsJustReleased, short buttonsHeld, float rightShoulder,
+ float leftShoulder, float langle, float lmagnitude, short lmax1,
+ short lmax2, short lmin1, short lmin2, short lcenter1,
+ short lcenter2, float rangle, float rmagnitude, short rmax1,
+ short rmax2, short rmin1, short rmin2, short rcenter1,
+ short rcenter2) {
+ super(id);
+ this.leftShoulder = leftShoulder;
+ this.rightShoulder = rightShoulder;
+ buttonsEvent = new ClassicControllerButtonsEvent(id,
+ buttonsJustPressed, buttonsJustReleased, buttonsHeld);
+ classicControllerLeftJoystickEvent = new JoystickEvent(id, langle,
+ lmagnitude, lmax1, lmax2, lmin1, lmin2, lcenter1, lcenter2);
+ classicControllerRightJoystickEvent = new JoystickEvent(id, rangle,
+ rmagnitude, rmax1, rmax2, rmin1, rmin2, rcenter1, rcenter2);
+ }
+
+ /**
+ * Tell if there is a classic controller left joystick event.
+ *
+ * @return TRUE if there is a classic controller left joystick event, false
+ * otherwise.
+ */
+ public boolean isThereClassicControllerLeftJoystickEvent() {
+ return classicControllerLeftJoystickEvent != null;
+ }
+
+ /**
+ * Tell if there is a classic controller right joystick event.
+ *
+ * @return TRUE if there is a classic controller right joystick event, false
+ * otherwise.
+ */
+ public boolean isThereClassicControllerRightJoystickEvent() {
+ return classicControllerRightJoystickEvent != null;
+ }
+
+ /**
+ * Get the right shoulder button(range 0-1).
+ *
+ * @return value of the rightShoulder button.
+ */
+ public float getRightShoulder() {
+ return rightShoulder;
+ }
+
+ /**
+ * Get the left shoulder button(range 0-1).
+ *
+ * @return value of the leftShoulder button.
+ */
+ public float getLeftShoulder() {
+ return leftShoulder;
+ }
+
+ /**
+ * Get buttons event for the classic controller.
+ *
+ * @return the classic controller buttons event if there is one or null.
+ */
+ public ClassicControllerButtonsEvent getButtonsEvent() {
+ return buttonsEvent;
+ }
+
+ /**
+ * Get event from the right joystick of the classic controller.
+ *
+ * @return the classic controller right Joystick Event if there is one or null.
+ */
+ public JoystickEvent getClassicControllerRightJoystickEvent() {
+ return classicControllerRightJoystickEvent;
+ }
+
+ /**
+ * Get event from the left joystick of the classic controller.
+ *
+ * @return the classic controller left Joystick Event if there is one or null.
+ */
+ public JoystickEvent getClassicControllerLeftJoystickEvent() {
+ return classicControllerLeftJoystickEvent;
+ }
+
+ @Override
+ public String toString() {
+ String out = "";
+ /* Status */
+ out += "/*********** Classis Controller EVENT : WIIMOTE ID :"
+ + getWiimoteId() + " ********/\n";
+ out += buttonsEvent;
+ out += "Left shoulder : " + leftShoulder + "\n";
+ out += "Right shoulder : " + rightShoulder + "\n";
+ out += classicControllerLeftJoystickEvent;
+ out += classicControllerRightJoystickEvent;
+ return out;
+ }
+
+}
diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java
new file mode 100644
index 0000000..df04048
--- /dev/null
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java
@@ -0,0 +1,214 @@
+/* This file is part of WiiuseJ.
+ *
+ * WiiuseJ 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.
+ *
+ * WiiuseJ 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 WiiuseJ. If not, see .
+ */
+package wiiusej.wiiusejevents.physicalevents;
+
+/**
+ * Class which represents a buttons event from a Guitar Hero controller.
+ *
+ * @author guiguito
+ */
+public class GuitarHeroButtonsEvent extends ButtonsEvent {
+
+ private static short GUITAR_HERO_3_BUTTON_STRUM_UP = 0x0001;
+ private static short GUITAR_HERO_3_BUTTON_YELLOW = 0x0008;
+ private static short GUITAR_HERO_3_BUTTON_GREEN = 0x0010;
+ private static short GUITAR_HERO_3_BUTTON_BLUE = 0x0020;
+ private static short GUITAR_HERO_3_BUTTON_RED = 0x0040;
+ private static short GUITAR_HERO_3_BUTTON_ORANGE = 0x0080;
+ private static short GUITAR_HERO_3_BUTTON_PLUS = 0x0400;
+ private static short GUITAR_HERO_3_BUTTON_MINUS = 0x1000;
+ private static short GUITAR_HERO_3_BUTTON_STRUM_DOWN = 0x4000;
+ private static int GUITAR_HERO_3_BUTTON_ALL = 0xFEFF;
+
+ /**
+ * Constructor of the guitar hero buttons Event.
+ *
+ * @param id
+ * id of the wiimote.
+ * @param buttonsJustPressed
+ * buttons just pressed.
+ * @param buttonsJustReleased
+ * buttons just released.
+ * @param buttonsHeld
+ * buttons just pressed.
+ */
+ public GuitarHeroButtonsEvent(int id, short buttonsJustPressed,
+ short buttonsJustReleased, short buttonsHeld) {
+ super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld);
+ }
+
+ /* Button Strum Up */
+
+ public boolean isButtonStrumUpJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_UP);
+ }
+
+ public boolean isButtonStrumUpJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_STRUM_UP);
+ }
+
+ public boolean isButtonStrumUpeHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_STRUM_UP);
+ }
+
+ public boolean isButtonStrumUpPressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_UP);
+ }
+
+ /* Button Strum Down */
+
+ public boolean isButtonStrumDownJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN);
+ }
+
+ public boolean isButtonStrumDownJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_STRUM_DOWN);
+ }
+
+ public boolean isButtonStrumDowneHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_STRUM_DOWN);
+ }
+
+ public boolean isButtonStrumDownPressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN);
+ }
+
+ /* Button blue */
+
+ public boolean isButtonBlueJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_BLUE);
+ }
+
+ public boolean isButtonBlueJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_BLUE);
+ }
+
+ public boolean isButtonBlueHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_BLUE);
+ }
+
+ public boolean isButtonBluePressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_BLUE);
+ }
+
+ /* Button Green */
+
+ public boolean isButtonGreenJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_GREEN);
+ }
+
+ public boolean isButtonGreenJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_GREEN);
+ }
+
+ public boolean isButtonGreenHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_GREEN);
+ }
+
+ public boolean isButtonGreenPressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_GREEN);
+ }
+
+ /* Button Minus */
+
+ public boolean isButtonMinusJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_MINUS);
+ }
+
+ public boolean isButtonMinusJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_MINUS);
+ }
+
+ public boolean isButtonMinusHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_MINUS);
+ }
+
+ public boolean isButtonMinusPressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_MINUS);
+ }
+
+ /* Button Orange */
+
+ public boolean isButtonOrangeJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_ORANGE);
+ }
+
+ public boolean isButtonOrangeJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_ORANGE);
+ }
+
+ public boolean isButtonOrangeHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_ORANGE);
+ }
+
+ public boolean isButtonOrangePressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_ORANGE);
+ }
+
+ /* Button Plus */
+
+ public boolean isButtonPlusJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_PLUS);
+ }
+
+ public boolean isButtonPlusJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_PLUS);
+ }
+
+ public boolean isButtonPlusHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_PLUS);
+ }
+
+ public boolean isButtonPlusPressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_PLUS);
+ }
+
+ /* Button Red */
+
+ public boolean isButtonRedJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_RED);
+ }
+
+ public boolean isButtonRedJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_RED);
+ }
+
+ public boolean isButtonRedHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_RED);
+ }
+
+ public boolean isButtonRedPressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_RED);
+ }
+
+ /* Button Yellow */
+
+ public boolean isButtonYellowJustPressed() {
+ return isButtonJustPressed(GUITAR_HERO_3_BUTTON_YELLOW);
+ }
+
+ public boolean isButtonYellowJustReleased() {
+ return isButtonJustReleased(GUITAR_HERO_3_BUTTON_YELLOW);
+ }
+
+ public boolean isButtonYellowHeld() {
+ return isButtonHeld(GUITAR_HERO_3_BUTTON_YELLOW);
+ }
+
+ public boolean isButtonYellowPressed() {
+ return isButtonPressed(GUITAR_HERO_3_BUTTON_YELLOW);
+ }
+}
diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java
new file mode 100644
index 0000000..f5c30b6
--- /dev/null
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java
@@ -0,0 +1,119 @@
+/**
+ * This file is part of WiiuseJ.
+ *
+ * WiiuseJ 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.
+ *
+ * WiiuseJ 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 WiiuseJ. If not, see .
+ */
+package wiiusej.wiiusejevents.physicalevents;
+
+/**
+ * This class represents the values from the GuitarHero and its events.
+ *
+ * @author guiguito
+ */
+public class GuitarHeroEvent extends ExpansionEvent{
+
+ private float whammyBar;
+ private GuitarHeroButtonsEvent buttonsEvent;
+ private JoystickEvent guitarHeroJoystickEvent;
+
+ /**
+ * Constructor of GuitarHeroEvent.
+ *
+ * @param id
+ * id of the wiimote.
+ * @param buttonsJustPressed
+ * buttons just pressed.
+ * @param buttonsJustReleased
+ * buttons just released.
+ * @param buttonsHeld
+ * buttons just pressed.
+ * @param whammyBar
+ * whammy bar (range 0-1).
+ * @param angle
+ * angle the joystick is being held.
+ * @param magnitude
+ * magnitude of the joystick (range 0-1).
+ * @param max1
+ * maximum joystick value 1.
+ * @param max2
+ * maximum joystick value 2.
+ * @param min1
+ * minimum joystick value 1.
+ * @param min2
+ * minimum joystick value 2.
+ * @param center1
+ * center joystick value 1.
+ * @param center2
+ * center joystick value 2.
+ */
+ public GuitarHeroEvent(int id, short buttonsJustPressed,
+ short buttonsJustReleased, short buttonsHeld, float whammyBar,
+ float angle, float magnitude, short max1,
+ short max2, short min1, short min2, short center1,
+ short center2) {
+ super(id);
+ this.whammyBar = whammyBar;
+ buttonsEvent = new GuitarHeroButtonsEvent(id,
+ buttonsJustPressed, buttonsJustReleased, buttonsHeld);
+ guitarHeroJoystickEvent = new JoystickEvent(id, angle,
+ magnitude, max1, max2, min1, min2, center1, center2);
+
+ }
+
+ /**
+ * Tell if there is a Guitar Hero joystick event.
+ *
+ * @return TRUE if there is a Guitar Hero joystick event, false otherwise.
+ */
+ public boolean isThereGuitarHeroJoystickEvent() {
+ return guitarHeroJoystickEvent != null;
+ }
+
+ /**
+ * Whammy bar (range 0-1).
+ * @return the whammyBar value.
+ */
+ public float getWhammyBar() {
+ return whammyBar;
+ }
+
+ /**
+ * Get buttons event for the guitar hero controller.
+ * @return the guitar hero controller buttons event if there is one or null.
+ */
+ public GuitarHeroButtonsEvent getButtonsEvent() {
+ return buttonsEvent;
+ }
+
+ /**
+ * Get event from the joystick of the guitar hero controller.
+ * @return the guitar hero controller joystick Event if there is one or null.
+ */
+ public JoystickEvent getGuitarHeroJoystickEvent() {
+ return guitarHeroJoystickEvent;
+ }
+
+ @Override
+ public String toString() {
+ String out = "";
+ /* Status */
+ out += "/*********** Classis Controller EVENT : WIIMOTE ID :" + getWiimoteId()
+ + " ********/\n";
+ out += buttonsEvent;
+ out += "Whammy Bar : "+whammyBar+"\n";
+ out += guitarHeroJoystickEvent;
+ return out;
+ }
+
+}
diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java
index b6584d6..d1af6af 100644
--- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java
@@ -17,8 +17,7 @@
package wiiusej.wiiusejevents.physicalevents;
/**
- * Class which represents a buttons event for a generic event. It means buttons
- * from a wiimote.
+ * Class which represents a buttons event from a Nunchuk.
*
* @author guiguito
*/
@@ -29,7 +28,7 @@ public class NunchukButtonsEvent extends ButtonsEvent {
private static short NUNCHUK_BUTTON_ALL = 0x03;
/**
- * Constructor of the nunchuk button Event.
+ * Constructor of the nunchuk buttons Event.
*
* @param id
* id of the wiimote.
diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java
index eec7b97..d990f60 100644
--- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java
@@ -23,9 +23,9 @@ package wiiusej.wiiusejevents.physicalevents;
*/
public class NunchukEvent extends ExpansionEvent {
- NunchukButtonsEvent buttonsEvent;
- MotionSensingEvent nunchukMotionSensingEvent;
- JoystickEvent nunchukJoystickEvent;
+ private NunchukButtonsEvent buttonsEvent;
+ private MotionSensingEvent nunchukMotionSensingEvent;
+ private JoystickEvent nunchukJoystickEvent;
/**
* Constructor of NunchukEvent.
@@ -123,9 +123,9 @@ public class NunchukEvent extends ExpansionEvent {
}
/**
- * Get joystick buttons event.
+ * Get nunchuk buttons event.
*
- * @return the joystick buttons event if there is one or null.
+ * @return the nunchuk buttons event if there is one or null.
*/
public NunchukButtonsEvent getButtonsEvent() {
return buttonsEvent;
diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java b/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java
index 04c1840..4027087 100644
--- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java
@@ -30,10 +30,10 @@ import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
*/
public class WiimoteEvent extends WiiUseApiEvent {
- WiimoteButtonsEvent buttonsEvent = null;
- IREvent infraredEvent = null;
- MotionSensingEvent motionSensingEvent = null;
- ExpansionEvent expansionEvent = null;
+ private WiimoteButtonsEvent buttonsEvent = null;
+ private IREvent infraredEvent = null;
+ private MotionSensingEvent motionSensingEvent = null;
+ private ExpansionEvent expansionEvent = null;
/**
* Construct the Wiimote setting up the id.