public void Draw(Transform2 parentTransform) { if (_isRunning) { _current.Draw(parentTransform); } else { _visual.Draw(parentTransform); } }
public void Draw(LayerInfo layer) { foreach ((int _, List <IAnimation> queue) in _current) { IAnimation animation = queue.FirstOrDefault(); if (animation != null) { animation.Draw(layer); } } }
public virtual void Draw(SpriteBatch spriteBatch) { if (AwaitAvatar) { loadingAnimation.Draw(spriteBatch); } if (ShowAvatar) { spriteBatch.Draw(AvatarTexture, AvatarRectangle, null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.08f); } spriteBatch.Draw(Texture, BannerRectangle, null, color, 0.0f, Vector2.Zero, SpriteEffects.None, 0.09f); spriteBatch.DrawString(Font, PlayerName, FontLocation, Color.Black); }
/// <summary> /// Записать развитие модели на видео /// </summary> /// <param name="model">Модель развития</param> /// <param name="param">Параметры отображения</param> /// <param name="fps">Количество кадров в секунду</param> /// <param name="spf">Количество этапов развития за кадр</param> /// <param name="frameCount">Количество кадров</param> /// <param name="speedK">Ускорение развития системы за одну секунду</param> public static void Record(this IAnimation model, DrawParams param, int fps, int spf, int frameCount, float speedK) { var writer = new VideoFileWriter(); writer.Open( $"out{Directory.GetFiles(Environment.CurrentDirectory).Count(x => x.Contains("out"))}.mp4", (int)param.Rect.Width, (int)param.Rect.Height, fps, VideoCodec.MPEG4, (int)(10 * param.Rect.Width * param.Rect.Height)); ProgressWindow pr = new ProgressWindow(frameCount); float deltaShift = -0.3F; double zoomK = speedK; float zoomKPerFrame = (float)Math.Pow(zoomK, zoomK / fps); param.ZoomK = zoomKPerFrame; using (var bmp = new Bitmap(writer.Width, writer.Height)) { using (var g = Graphics.FromImage(bmp)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.TextRenderingHint = TextRenderingHint.AntiAlias; for (int i = 0; i < frameCount; i++) { g.Clear(Color.Black); model.Draw(g, param); for (int j = 0; j < spf; j++) { model.NextStage(); } //param.Shift(deltaShift, 0); //deltaShift *= speedK; param.ZoomOut(0, param.Rect.Height * 4 / 5); writer.WriteVideoFrame(bmp); pr.Next(); } } } pr.Dispose(); writer.Close(); }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 position) { _currentAnimation.Draw(spriteBatch, position); }