public KeyFrameControl(Game game) : base(game) { int hOffset = 16; int x1 = hOffset; int x2 = 1024 - hOffset; int y1 = 768 - 96; int y2 = 768; spriteBatch = new SpriteBatch(Game.GraphicsDevice); frameBar = new DrawableRect(x1, y1, x2, y2, Color.LightGray); currentFrameBar = new DrawableRect(-2, 0, 2, 100, Color.Yellow); }
/* public void DrawKeyFrameIndicator(int index) { var rect = new DrawableRect(-1, 0, 1, 100, Color.Yellow); DrawRect(rect, Matrix.CreateTranslation(16 + ((1024 - 2 * 16) / 250f) * index, 768 - 100, 0)); } */ public void DrawRect(DrawableRect rect, Matrix transformation) { var effect = EffectCatalog.ScreenSpaceEffect; effect.Parameters["World"].SetValue(transformation); effect.CurrentTechnique.Passes[0].Apply(); GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, rect.Vertices, 0, rect.Vertices.Length, rect.Indices, 0, rect.Indices.Length / 3); }