//private DrawingTest dt; public MainWindow() { DataContext = this; InitializeComponent(); this.Show(); this.Topmost = true; drawingController = new DrawingController(); drawingStatus = new DrawingStatus(); drawingStatus.eye.x = 0.0f; drawingStatus.eye.y = 5.0f; drawingStatus.eye.z = 25.0f; drawingStatus.kinect.x = 0.0f; drawingStatus.kinect.y = 0.34f; drawingStatus.kinect.z = 0.0f; drawingController.ChangeStatus(drawingStatus); // initialize kinect InitKinect(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e">Gesture event arguments.</param> private void OnGestureRecognized(object sender, GestureEventArgs e) { Debug.WriteLine(e.GestureType); switch (e.GestureType) { case GestureType.HandCloseOrOpen: //Gesture = "HandCloseOrOpen"; break; case GestureType.MenuIn: drawingController.SendSingle(DrawingEnumTypes.Movement.MenuIn); Gesture = "MenuIn"; break; case GestureType.MenuOut: drawingController.SendSingle(DrawingEnumTypes.Movement.MenuOut); Gesture = "MenuOut"; break; case GestureType.MoveDown: drawingController.SendSingle(DrawingEnumTypes.Movement.MoveDown); Gesture = "MoveDown"; break; case GestureType.MoveIn: drawingController.SendSingle(DrawingEnumTypes.Movement.MoveIn); Gesture = "MoveIn"; break; case GestureType.MoveLeft: drawingController.SendSingle(DrawingEnumTypes.Movement.MoveLeft); Gesture = "MoveLeft"; break; case GestureType.MoveOut: drawingController.SendSingle(DrawingEnumTypes.Movement.MoveOut); Gesture = "MoveOut"; break; case GestureType.MoveRight: drawingController.SendSingle(DrawingEnumTypes.Movement.MoveRight); Gesture = "MoveRight"; break; case GestureType.MoveUp: drawingController.SendSingle(DrawingEnumTypes.Movement.MoveUp); Gesture = "MoveUp"; break; case GestureType.HeadMoved: Gesture = "HeadMoved: new position(" + e.GestureStatus.headPoint.X + "," + (e.GestureStatus.headPoint.Y + 0.2) + "," + e.GestureStatus.headPoint.Z + ")"; drawingStatus.eye.x = -e.GestureStatus.headPoint.Z; drawingStatus.eye.y = e.GestureStatus.headPoint.Y; drawingStatus.eye.z = e.GestureStatus.headPoint.X; drawingController.ChangeStatus(drawingStatus); this.txtEyex.Text = e.GestureStatus.headPoint.X + ""; this.txtEyey.Text = e.GestureStatus.headPoint.Y + ""; this.txtEyez.Text = e.GestureStatus.headPoint.Z + ""; this.txtKinectx.Text = "0"; this.txtKinecty.Text = "0.2"; this.txtKinectz.Text = "0"; //dt.SetLookat(e.GestureStatus.headPoint.X, e.GestureStatus.headPoint.Y+2, e.GestureStatus.headPoint.Z); break; default: break; } End.Text = Gesture; }