using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace WindowsGame1 { public class PeanutsView { private PeanutsModel model; public PeanutsView(PeanutsModel m) { model = m; } public void Draw(GraphicsDeviceManager graphics, SpriteBatch spriteBatch, Texture2D texture, SpriteFont font) { IList sprites = model.GetSprites(); foreach (Sprite s in sprites) { int scale = Math.Min(graphics.GraphicsDevice.Viewport.Height, graphics.GraphicsDevice.Viewport.Width); int left = (int)((s.GetX() - s.GetBoundingRadius()) * scale); int top = (int)((s.GetY() - s.GetBoundingRadius()) * scale); int size = (int)(s.GetBoundingRadius() * scale); spriteBatch.Draw(texture, new Rectangle(left, top, size, size), s.GetColor()); } } } }