2011-11-09 12:31:32 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using ANX.Framework;
|
|
|
|
using ANX.Framework.Content;
|
|
|
|
using ANX.Framework.Graphics;
|
|
|
|
using ANX.Framework.Input;
|
2011-11-11 07:29:49 +00:00
|
|
|
using ANX.Framework.Input.MotionSensing;
|
2011-11-09 12:31:32 +00:00
|
|
|
|
|
|
|
namespace Kinect
|
|
|
|
{
|
|
|
|
public class Game1 : ANX.Framework.Game
|
|
|
|
{
|
|
|
|
GraphicsDeviceManager graphics;
|
|
|
|
SpriteBatch spriteBatch;
|
|
|
|
|
2011-11-11 07:29:49 +00:00
|
|
|
MotionSensingDeviceState kinectState;
|
|
|
|
|
2011-11-09 12:31:32 +00:00
|
|
|
public Game1()
|
|
|
|
{
|
|
|
|
graphics = new GraphicsDeviceManager(this);
|
2011-11-09 19:39:21 +00:00
|
|
|
Content.RootDirectory = "SampleContent";
|
2011-11-09 12:31:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Initialize()
|
|
|
|
{
|
2011-11-11 07:29:49 +00:00
|
|
|
MotionSensingDevice.GraphicsDevice = GraphicsDevice;
|
2011-11-09 12:31:32 +00:00
|
|
|
|
|
|
|
base.Initialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadContent()
|
|
|
|
{
|
|
|
|
spriteBatch = new SpriteBatch(GraphicsDevice);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update(GameTime gameTime)
|
|
|
|
{
|
2011-12-15 12:59:20 +00:00
|
|
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
|
|
|
|
this.Exit();
|
2011-11-09 12:31:32 +00:00
|
|
|
|
2011-11-11 07:29:49 +00:00
|
|
|
kinectState = MotionSensingDevice.GetState();
|
2011-11-09 12:31:32 +00:00
|
|
|
|
|
|
|
base.Update(gameTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Draw(GameTime gameTime)
|
|
|
|
{
|
|
|
|
GraphicsDevice.Clear(Color.Black);
|
|
|
|
|
2011-11-11 07:29:49 +00:00
|
|
|
if (kinectState.Depth != null)
|
|
|
|
{
|
|
|
|
spriteBatch.Begin();
|
|
|
|
|
|
|
|
spriteBatch.Draw(kinectState.RGB, Vector2.Zero, Color.White);
|
|
|
|
|
|
|
|
spriteBatch.End();
|
|
|
|
}
|
2011-11-09 12:31:32 +00:00
|
|
|
|
|
|
|
base.Draw(gameTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|