using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Graphics; namespace KinPortal { public class Cursor : DrawableGameComponent { public Point Pos {get; set;} public Point Size {get; set;} public Texture2D Texture {get; set;} public HandsState Hand {get; private set;} private SpriteBatch m_cursor; public Cursor(KinPortal.Game game, SpriteBatch sprite,string filepath, Point size, HandsState hand) : base(game) { Pos = new Point(0, 0); Size = size; Texture = Game.Content.Load(filepath); Hand = hand; m_cursor = sprite; UpdateOrder = 2; } public override void Update(GameTime gameTime) { KinPortal.Game game = (KinPortal.Game) Game; Pos = Hand.Pos; base.Update(gameTime); } public override void Draw(GameTime gameTime) { Rectangle place = new Rectangle(Pos.X - Size.X / 2, Pos.Y - Size.Y / 2, Size.X, Size.Y); m_cursor.Begin(); m_cursor.Draw(Texture, place, Color.White); m_cursor.End(); base.Draw(gameTime); } } }