public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (_drawContext == null || _drawContext.GraphicsDevice != GraphicsDevice) { _drawContext = new DrawContext(GraphicsDevice, Matrix.Identity); } _drawContext.Begin(Matrix.Identity); try { _universe.Draw(_drawContext, gameTime); } finally { _drawContext.End(); } }
public void Draw(DrawContext context, GameTime gameTime) { foreach (var view in Items) { if (!view.IsVisible) { continue; } var matrix = context.Matrix * Matrix.CreateTranslation(view.Frame.X, view.Frame.Y, 0); context.Begin(matrix); try { view.Draw(context, gameTime); } finally { context.End(); } } }