/// <summary> /// Allows the page to draw itself. /// </summary> private void OnDraw(object sender, GameTimerEventArgs e) { SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black); //draws the bases _uiRender.Render(); spriteBatch.Begin(); _line.Draw(spriteBatch); _missileManager.Draw(spriteBatch, SharedGraphicsDeviceManager.Current.GraphicsDevice); for (int i = 0; i < _buildings.Length; i++) { if (_buildings[i] != null) { _buildings[i].Draw(spriteBatch); } } _leftBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, spriteBatch); _middleBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, spriteBatch); _rightBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, spriteBatch); //draws the 3 bases _leftBase.Draw(spriteBatch); _rightBase.Draw(spriteBatch); _middleBase.Draw(spriteBatch); //draws overlay spriteBatch.Draw(_uiRender.Texture, Vector2.Zero, Color.White); spriteBatch.End(); // TODO: Add your drawing code here }
private void OnDraw(object sender, GameTimerEventArgs e) { SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black); //draws the bases _uiRender.Render(); spriteBatch.Begin(); _missileManager.Draw(spriteBatch, SharedGraphicsDeviceManager.Current.GraphicsDevice); _line.Draw(spriteBatch); spriteBatch.Draw(_uiRender.Texture, Vector2.Zero, Microsoft.Xna.Framework.Color.White); spriteBatch.End(); // TODO: Add your drawing code here }
public void draw() { Game1.game.spriteBatch.Begin(); if (_isInPlay) { Game1.game.spriteBatch.DrawString(_font, "Score:" + _score, new Vector2(0, 20), Color.White, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); Game1.game.spriteBatch.DrawString(_font, "Percent Multiplier:" + _percentMultiplier * 100 + "%", new Vector2(0, 0), Color.White, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); Game1.game.spriteBatch.DrawString(_font, "Bases:" + _missileBases, new Vector2(Game1.game.GraphicsDevice.Viewport.Width - _font.MeasureString("Bases:" + _missileBases).X * .5f - 10f, 0), Color.White, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); Game1.game.spriteBatch.DrawString(_font, "Cities:" + _city, new Vector2(Game1.game.GraphicsDevice.Viewport.Width - _font.MeasureString("Cities" + _city).X * .5f - 10f, 20), Color.White, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); } _line.Draw(Game1.game.spriteBatch); _missileManager.Draw(Game1.game.spriteBatch, Game1.game.GraphicsDevice); for (int i = 0; i < _buildings.Length; i++) { if (_buildings[i] != null) { _buildings[i].Draw(Game1.game.spriteBatch); } } if (_isInPlay) { _leftBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, Game1.game.spriteBatch); _middleBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, Game1.game.spriteBatch); _rightBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, Game1.game.spriteBatch); } //draws the 3 bases _leftBase.Draw(Game1.game.spriteBatch); _rightBase.Draw(Game1.game.spriteBatch); _middleBase.Draw(Game1.game.spriteBatch); if (this._selectedArrow == 3) { Game1.game.spriteBatch.DrawString(_font, "Q", new Vector2(_leftBase.GetRectangle.Left, _leftBase.GetRectangle.Bottom + 10), Color.Red, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); } else { Game1.game.spriteBatch.DrawString(_font, "Q", new Vector2(_leftBase.GetRectangle.Left, _leftBase.GetRectangle.Bottom + 10), Color.White, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); } if (this._selectedArrow == 2) { Game1.game.spriteBatch.DrawString(_font, "W", new Vector2(_middleBase.GetRectangle.Left, _middleBase.GetRectangle.Bottom + 10), Color.Red, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); } else { Game1.game.spriteBatch.DrawString(_font, "W", new Vector2(_middleBase.GetRectangle.Left, _middleBase.GetRectangle.Bottom + 10), Color.White, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); } if (this._selectedArrow == 1) { Game1.game.spriteBatch.DrawString(_font, "E", new Vector2(_rightBase.GetRectangle.Left, _rightBase.GetRectangle.Bottom + 10), Color.Red, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); } else { Game1.game.spriteBatch.DrawString(_font, "E", new Vector2(_rightBase.GetRectangle.Left, _rightBase.GetRectangle.Bottom + 10), Color.White, 0, Vector2.Zero, .5f, SpriteEffects.None, 0); } //draws overlay // spriteBatch.Draw(_uiRender.Texture, Vector2.Zero, Color.White); Game1.game.spriteBatch.End(); }