Mogelijkheid tot het sturen van Actions naar Devices toegevoegd. Gestures ingevoerd in de WiimoteDevice. Herkennen is nog niet constant succesvol!
This commit is contained in:
70
java/src/pm/device/wiimote/gesture/GestureDevice.java
Normal file
70
java/src/pm/device/wiimote/gesture/GestureDevice.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package pm.device.wiimote.gesture;
|
||||
|
||||
import org.wiigee.device.Device;
|
||||
import org.wiigee.event.ButtonListener;
|
||||
import org.wiigee.event.ButtonPressedEvent;
|
||||
import org.wiigee.event.GestureListener;
|
||||
import pm.device.wiimote.gesture.event.Close;
|
||||
import pm.device.wiimote.gesture.event.Recognize;
|
||||
import pm.device.wiimote.gesture.event.Train;
|
||||
|
||||
public class GestureDevice extends Device /*implements AccelerationListener */{
|
||||
public static final boolean AUTOFILTERING = true;
|
||||
//public static final boolean AUTOMOTION = true;
|
||||
|
||||
public GestureDevice(boolean autofiltering/*, boolean automotion*/) {
|
||||
super(autofiltering);
|
||||
/*if (automotion) {
|
||||
addAccelerationListener(this);
|
||||
}*/
|
||||
}
|
||||
|
||||
public GestureDevice() {
|
||||
this(AUTOFILTERING/*, AUTOMOTION*/);
|
||||
}
|
||||
|
||||
public void add(GestureListener gestureListener) {
|
||||
addGestureListener(gestureListener);
|
||||
}
|
||||
|
||||
public void add(double[] vector) {
|
||||
fireAccelerationEvent(vector);
|
||||
}
|
||||
|
||||
public void recognize() {
|
||||
fireButtonPressedEvent(new Recognize(this));
|
||||
}
|
||||
|
||||
public void train() {
|
||||
fireButtonPressedEvent(new Train(this));
|
||||
}
|
||||
|
||||
public void close() {
|
||||
fireButtonPressedEvent(new Close(this));
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
fireButtonReleasedEvent(0);
|
||||
}
|
||||
|
||||
public void fireButtonPressedEvent(ButtonPressedEvent buttonPressedEvent) {
|
||||
for (ButtonListener bttnLstnr : buttonlistener) {
|
||||
bttnLstnr.buttonPressReceived(buttonPressedEvent);
|
||||
}
|
||||
if (buttonPressedEvent.isRecognitionInitEvent() || buttonPressedEvent.isTrainInitEvent()) {
|
||||
this.resetAccelerationFilters();
|
||||
}
|
||||
}
|
||||
|
||||
/*public void accelerationReceived(AccelerationEvent event) {}
|
||||
|
||||
public void motionStartReceived(MotionStartEvent event) {
|
||||
//System.out.println("Motion start!");
|
||||
recognize();
|
||||
}
|
||||
|
||||
public void motionStopReceived(MotionStopEvent event) {
|
||||
//System.out.println("Motion stop!");
|
||||
stop();
|
||||
}*/
|
||||
}
|
||||
Reference in New Issue
Block a user