reorganized files and a part of the architecture.
This version needs to be tested. Don't forget to add comments. git-svn-id: http://wiiusej.googlecode.com/svn/trunk@64 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
89
WiiUseJ/src/wiiusej/wiiuseapievents/MotionSensingEvent.java
Normal file
89
WiiUseJ/src/wiiusej/wiiuseapievents/MotionSensingEvent.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package wiiusej.wiiuseapievents;
|
||||
|
||||
import wiiusej.values.GForce;
|
||||
import wiiusej.values.Orientation;
|
||||
|
||||
/**
|
||||
* Class which represents a motion sensing event.
|
||||
* @author guiguito
|
||||
*
|
||||
*/
|
||||
public class MotionSensingEvent extends WiimoteEvent{
|
||||
|
||||
/* Motion Sensing */
|
||||
private Orientation orientation;
|
||||
private GForce gforce;
|
||||
|
||||
/**
|
||||
* Constructor for a Motion Sensing Event.
|
||||
*
|
||||
* @param id
|
||||
* id of the wiimote concerned.
|
||||
* @param r
|
||||
* roll
|
||||
* @param p
|
||||
* pitch
|
||||
* @param ya
|
||||
* yaw
|
||||
* @param x
|
||||
* gravity force on x axis
|
||||
* @param y
|
||||
* gravity force on y axis
|
||||
* @param z
|
||||
* gravity force on z axis
|
||||
*/
|
||||
public MotionSensingEvent(int id, float r, float p, float ya, float x, float y,
|
||||
float z) {
|
||||
super(id);
|
||||
setOrientationAndGforce(r, p, ya, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set orientation and gravity force.
|
||||
*
|
||||
* @param r
|
||||
* roll
|
||||
* @param p
|
||||
* pitch
|
||||
* @param ya
|
||||
* yaw
|
||||
* @param x
|
||||
* gravity force on x axis
|
||||
* @param y
|
||||
* gravity force on y axis
|
||||
* @param z
|
||||
* gravity force on z axis
|
||||
*/
|
||||
private void setOrientationAndGforce(float r, float p, float ya, float x,
|
||||
float y, float z) {
|
||||
this.orientation = new Orientation(r, p, ya);
|
||||
this.gforce = new GForce(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the orientation
|
||||
*/
|
||||
public Orientation getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the gravity force.
|
||||
*
|
||||
* @return the gforce
|
||||
*/
|
||||
public GForce getGforce() {
|
||||
return gforce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String out = "";
|
||||
/* Motion sensing */
|
||||
out += "/******** Motion sensing ********/\n";
|
||||
out += "--- Motion sensing : true \n";
|
||||
out += "--- " + orientation + "\n";
|
||||
out += "--- " + gforce + "\n";
|
||||
return out;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user