/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); lineBatch = new LineBatch(GraphicsDevice); smallFont = Content.Load<SpriteFont>("Fonts/small"); largeFont = Content.Load<SpriteFont>("Fonts/large"); lineBatch.SetProjection(Matrix.CreateOrthographicOffCenter(0.0f, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0.0f, 0.0f, 1.0f)); }
/// <summary> /// Draw the particle system /// </summary> /// <param name="lineBatch">The line batch that will draw the particles</param> public virtual void Draw(LineBatch lineBatch) { if (lifeRemaining > 0f) { if (lineBatch == null) { throw new ArgumentNullException("lineBatch"); } for (int i = 0; i < particles.Length; i++) { lineBatch.DrawLine(particles[i].Position, particles[i].Position - particles[i].Velocity * tailLength, particles[i].Color); } } }
/// <summary> /// Render the object /// </summary> /// <param name="elapsedTime">Amount of elapsed time in seconds</param> /// <param name="lineBatch">LineBatch to render to</param> public virtual void Draw(float elapsedTime, LineBatch lineBatch) { if (IsAlive) { if (polygon != null) { if (lineBatch == null) { throw new ArgumentNullException("lineBatch"); } lineBatch.DrawPolygon(polygon, color); } } }