public void Draw(SpriteBatch spriteBatch) { if (BGTexture == null) { BGTexture = new Texture2D(spriteBatch.GraphicsDevice, 1, 1); BGTexture.SetData(new Color[] {Color.White}); } // draw the background Rectangle bg = new Rectangle(Game1.ScreenWidth / 4, Game1.ScreenHeight / 4, Game1.ScreenWidth / 2, Game1.ScreenHeight / 2); spriteBatch.Draw(BGTexture, bg, Color.Black); // draw each option int yOffset = bg.Height / Options.Length; int yPos = bg.Top + (yOffset / 2); foreach (String opt in Options) { Vector2 size = Game1.Font.MeasureString(opt); Vector2 pos = new Vector2((Game1.ScreenWidth / 2) - (size.X / 2), yPos - (size.Y / 2)); spriteBatch.DrawString(Game1.Font, opt, pos, Color.White); yPos += yOffset; } // draw the selection box Vector2 selTextSize = Game1.Font.MeasureString(Options[Position]); int selThickness = yOffset / 10; Rectangle selArea = new Rectangle(bg.Left, bg.Top + yOffset * Position, bg.Width, yOffset); Border b = new Border(selArea, selThickness, Color.Green); b.Draw(spriteBatch); }
public void Draw(SpriteBatch spriteBatch) { Rectangle size = Texture.Bounds; float scale = (float)Width / size.Width; int scaleWidth = (int)(size.Width * scale); int scaleHeight = (int)(size.Height * scale); Rectangle r = new Rectangle( XPos, (Game1.ScreenHeight - scaleHeight) / 2, scaleWidth, scaleHeight ); spriteBatch.Draw(Texture, r, Color.White); int superSecretSeparatorThickness = (int)(7 * scale); Rectangle tileArea = new Rectangle( XPos + 2 * superSecretSeparatorThickness, (Game1.ScreenHeight - scaleHeight) / 2 + 2 * superSecretSeparatorThickness, scaleWidth - 4 * superSecretSeparatorThickness, scaleWidth - 4 * superSecretSeparatorThickness); Rectangle borderArea = tileArea; borderArea.X -= 4; borderArea.Y -= 4; borderArea.Width += 8; borderArea.Height += 8; Border border = new Border(borderArea, 4, Color.Yellow); foreach (BloodyTile tile in Queue) { tile.draw(tileArea, spriteBatch); tileArea.Y += scaleWidth - superSecretSeparatorThickness-1; } //Debug.WriteLine("# tiles in queue: {0}", Queue.Count); border.Draw(spriteBatch); }
public void Draw(SpriteBatch spriteBatch) { Rectangle r = new Rectangle(XPos + grid_x * Width, YPos + grid_y * Height, Width, Height); Border border = new Border(r, Thickness, Color.Gold); border.Draw(spriteBatch); }