Example #1
0
        public TheGame(bool isRightHand)
        {
            this.isRightHand = isRightHand;

            s = new Sounds.Sounds();

            InitializeComponent();

            //Init GameFlow
            currentLevel = GameFlow.createGameFlow();

            Loaded += delegate
            {
                if (currentLevel.getLetter().ToString().Length > 1)
                {
                    getScreenSize(currentLevel.getLetter());
                }
            };

            this.speechEngine = SpeechRecognition.init();
            this.speechEngine.SpeechRecognized += this.SpeechRecognized;


            _sensor = KinectSensor.GetDefault();

            if (_sensor != null)
            {
                _sensor.Open();

                _width  = _sensor.ColorFrameSource.FrameDescription.Width;
                _height = _sensor.ColorFrameSource.FrameDescription.Height;

                _colorReader = _sensor.ColorFrameSource.OpenReader();
                _colorReader.FrameArrived += ColorReader_FrameArrived;

                _bodyReader = _sensor.BodyFrameSource.OpenReader();
                _bodyReader.FrameArrived += BodyReader_FrameArrived;

                _pixels = new byte[_width * _height * 4];
                _bitmap = new WriteableBitmap(_width, _height, 96.0, 96.0, PixelFormats.Bgra32, null);

                _bodies = new Body[_sensor.BodyFrameSource.BodyCount];

                camera.Source = _bitmap;

                changeLetter();
            }

            polylines = new List <Polyline>();
            addNewPolyline();
            isSecondClick = false;
        }
Example #2
0
        /// <summary>
        /// Handler for recognized speech events.
        /// </summary>
        /// <param name="sender">object sending the event.</param>
        /// <param name="e">event arguments.</param>
        //Do

        /// <summary>
        /// Execute un-initialization tasks.
        /// </summary>
        /// <param name="sender">object sending the event.</param>
        /// <param name="e">event arguments.</param>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_colorReader != null)
            {
                _colorReader.Dispose();
            }

            if (_bodyReader != null)
            {
                _bodyReader.Dispose();
            }

            if (_sensor != null)
            {
                _sensor.Close();
            }


            SpeechRecognition.close();
        }