Converts points from KinectSpace to a provided rectangle fixing the center of the body as the center NOTE: Requires the person to be standing
Inheritance: IPointConverter
        private void RegisterGestures()
        {
            bodyConverter = new BodyRelativePointConverter(uxPersonRectangle.GetBoundaryRect(), this._sharedData.PlayerOneController);

            setHitZone();
            if (hitGesture == null)
            {
                hitGesture = new HitGesture(_hitZones, bodyConverter, JointType.HandRight, JointType.HandLeft);
                hitGesture.RectHit += new EventHandler<RectHitEventArgs>(hitGesture_RectHit);
            }
            _sharedData.PlayerOneController.AddGesture(this, hitGesture);
            uxPlayerSkeleton.InitializeSkeleton(_sharedData.PlayerOneController, bodyConverter);
        }
Example #2
0
 private void InitializeGame()
 {
     bodyConverter = new BodyRelativePointConverter(new Rect(100, 100, 1000, 1000));
     game = new BalanceGame();
     DependencyPropertyDescriptor.FromProperty(BalanceGame.HeldBallsProperty, game.GetType()).AddValueChanged(game, new EventHandler(BallsChanged));
     game.NewGame();
     // TODO: Actually provide valid coordinates
 }
Example #3
0
        private void RegisterGestures()
        {
            // TODO: Maybe clean up?
            playerOneConverter = new BodyRelativePointConverter(uxPlayerOneRect.GetBoundaryRect(), this._sharedData.PlayerOneController);
            playerTwoConverter = new BodyRelativePointConverter(uxPlayerTwoRect.GetBoundaryRect(), this._sharedData.PlayerTwoController);

            _playerOneHitGesture = new HitGesture(_hitZones, playerOneConverter, JointType.HandRight, JointType.HandLeft);
            _playerOneHitGesture.RectHit += new EventHandler<RectHitEventArgs>(hitGesture_RectHit);
            _sharedData.PlayerOneController.AddGesture(this, _playerOneHitGesture);

            _playerTwoHitGesture = new HitGesture(_hitZones, playerTwoConverter, JointType.HandRight, JointType.HandLeft);
            _playerTwoHitGesture.RectHit += new EventHandler<RectHitEventArgs>(hitGesture_RectHit);
            _sharedData.PlayerTwoController.AddGesture(this, _playerTwoHitGesture);

            uxPlayerOneSkeleton.InitializeSkeleton(_sharedData.PlayerOneController, playerOneConverter);
            uxPlayerTwoSkeleton.InitializeSkeleton(_sharedData.PlayerTwoController, playerTwoConverter);
        }