示例#1
0
        public void Update(GameTime gameTime)
        {
            Joint rightHand = kinect.GetCursorPosition();
            Point handPoint = new Point((int)rightHand.Position.X, (int)rightHand.Position.Y);

            if (boundingRectangle.Contains(handPoint))
            {
                if (clicked)
                {
                    timer -= 200;
                }
                else
                {
                    timer += gameTime.ElapsedGameTime.Milliseconds;
                }

                if (timer >= CLICK_TIME_OUT)
                {
                    timer -= 100;
                    if (Clicked != null)
                    {
                        Clicked(this, null);
                    }
                    clicked = true;
                }
                else if (timer <= 0)
                {
                    clicked = false;
                }
            }
            else
            {
                timer = 0;
            }
        }
示例#2
0
        public void Update(GameTime gameTime)
        {
            Joint RightHand = kinect.GetCursorPosition();

            position = new Vector2(RightHand.Position.X, RightHand.Position.Y);
        }