Share via


Tic Tac Toe-WPF C# Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Overview

When you run this sample, you see the following:

  • A "Welcome" screen. Press the Start button or say "start" to play the game.
  • After the game starts, say a number to specify a square on the board.
  • Kinect will assign the first voice to player "X" and the second voice to player "O".
The Sample Uses the Following APIs To Do This
KinectSensorCollection.StatusChanged event Choose a sensor and add an event handler for a StatusChanged event. This event is fired when the Kinect sensor status changes.
ColorImageFormat.RgbResolution640x480FPS30 enumeration value Choose the color stream format including the data type, resolution, and frame rate of the data.
KinectSensor.ColorStream property and ColorImageStream.Enable method Enable the sensor to stream out color data.
ImageStream.FramePixelDataLength property Specify the length of the pixel data buffer when you allocate memory to store the color stream data from the Kinect.
ImageStream.FrameWidth and ImageStream.FrameHeight properties Specify the width and height of the WriteableBitmap used to store/render the color data.
KinectSensor.ColorFrameReady event Add an event handler for the color data. The sensor will signal the event handler when each new frame of color data is ready.
ColorImageFrameReadyEventArgs.OpenColorImageFrame method Get a frame of color data in the event handler.
ColorImageFrame.CopyPixelDataTo method Copy a frame of color data to a pre-allocated array, so it can then be written to an optional WriteableBitmap.
SpeechRecognitionEngine class Create a speech recognition engine.
Grammar class Create a grammar for the speech recognition engine.
SpeechRecognizedEventArgs class Use the event arguments in functions, such as SpeechRecognized and SpeechRejected, to get information about an audio sample.
KinectSensor.Start and KinectSensor.Stop methods Start or stop the sensor.
KinectAudioSource.BeamAngleMode property Set the beam angle for the strongest audio source.
KinectAudioSource.SoundSourceAngleChanged event Add an event handler for a SoundSourceAngleChanged event. This event is fired when the Kinect sensor detects a new sound source. In noisy environments, this event can fire very frequently.
KinectAudioSource.Start and KinectAudioSource.Stop methods Start or stop the streaming of audio data.

For additional information about audio, see Capturing Audio Data in C#.

To run a sample you must have the Kinect for Windows SDK installed. To compile a sample, you must have the developer toolkit installed. The latest SDK and developer toolkit are available on the developer download page. If you need help installing the toolkit, look on this page: To Install the SDK and Toolkit. The toolkit includes a sample browser, which you can use to launch a sample or download it to your machine. To open the sample browser, click Start > All Programs > Kinect for Windows SDK [version number] > Developer Toolkit Browser.

If you need help loading a sample in Visual Studio or using Visual Studio to compile, run, or debug, see Opening, Building, and Running Samples in Visual Studio.