some work on Kinect InputSystem (Dispose, fetching of RGB image) changed handling of native textures (providing data for Texture2D at the moment) implemented SetData methods for Texture2D basic Dispose handling of Texture and Texture2D implemented RenderSystemDX10: moved FormatSize method to FormatConverter to avoid duplicated code RenderSystemGL3 is BROKEN in this version. New texture handling needs to be adapted.
68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using ANX.Framework;
|
|
using ANX.Framework.Content;
|
|
using ANX.Framework.Graphics;
|
|
using ANX.Framework.Input;
|
|
using ANX.Framework.Input.MotionSensing;
|
|
|
|
namespace Kinect
|
|
{
|
|
public class Game1 : ANX.Framework.Game
|
|
{
|
|
GraphicsDeviceManager graphics;
|
|
SpriteBatch spriteBatch;
|
|
|
|
MotionSensingDeviceState kinectState;
|
|
|
|
public Game1()
|
|
: base("DirectX10", "Kinect")
|
|
{
|
|
graphics = new GraphicsDeviceManager(this);
|
|
Content.RootDirectory = "SampleContent";
|
|
}
|
|
|
|
protected override void Initialize()
|
|
{
|
|
MotionSensingDevice.GraphicsDevice = GraphicsDevice;
|
|
|
|
base.Initialize();
|
|
}
|
|
|
|
protected override void LoadContent()
|
|
{
|
|
spriteBatch = new SpriteBatch(GraphicsDevice);
|
|
|
|
// TODO: Verwenden Sie this.Content, um Ihren Spiel-Inhalt hier zu laden
|
|
}
|
|
|
|
protected override void Update(GameTime gameTime)
|
|
{
|
|
//TODO: reactivate
|
|
//if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
|
|
// this.Exit();
|
|
|
|
kinectState = MotionSensingDevice.GetState();
|
|
|
|
base.Update(gameTime);
|
|
}
|
|
|
|
protected override void Draw(GameTime gameTime)
|
|
{
|
|
GraphicsDevice.Clear(Color.Black);
|
|
|
|
if (kinectState.Depth != null)
|
|
{
|
|
spriteBatch.Begin();
|
|
|
|
spriteBatch.Draw(kinectState.RGB, Vector2.Zero, Color.White);
|
|
|
|
spriteBatch.End();
|
|
}
|
|
|
|
base.Draw(gameTime);
|
|
}
|
|
}
|
|
}
|