public override void Project(Microsoft.Xna.Framework.GameTime gameTime, int x, int y, Services.IRender render) { base.Project(gameTime, x, y, render); render.Begin(); render.DrawSprite(Texture, new Rectangle(x, y, Width, Height), Color.White); render.End(); }
public override void Project(GameTime gameTime, int x, int y, Services.IRender render) { base.Project(gameTime, x, y, render); render.Begin(); render.DrawSprite(Top, new Rectangle(x, y, Width, Height - Bottom.Height), Color.White); render.DrawSprite(Bottom, new Rectangle(x, y + Height - Bottom.Height, Width, Bottom.Height), Color.White); int posX = x + menuItemMarginX; int posY = (y + Height / 2 - Font.CharHeight / 2); int count = 0; foreach (var item in MenuItems) { int strinW = Font.MeasureString(item.Name).X; if (count != SelectedMenuItem || !ItemIsOpen) { Color color = count == SelectedMenuItem ? FontHighlightColor : FontColor; if (count == SelectedMenuItem) { render.DrawHorizontalLine(new Point(posX, y + menuItemMarginY), strinW, HighlightBorder); render.DrawHorizontalLine(new Point(posX, y + Height - menuItemMarginY - 1), strinW, HighlightBorder); render.DrawVerticalLine(new Point(posX, y + menuItemMarginY), Height - menuItemMarginY * 2, HighlightBorder); render.DrawVerticalLine(new Point(posX + strinW, y + menuItemMarginY), Height - menuItemMarginY * 2, HighlightBorder); render.DrawRect(new Rectangle(posX + 1, y + menuItemMarginY + 1, strinW - 2, Height - menuItemMarginY * 2 - 3), HighlightBody); } Font.DrawString(item.Name, new Point(posX + 1, posY), color, render); } posX += strinW + menuItemMarginX; count += 1; } if (ItemIsOpen) { Parent.AddDrawDelegate(DrawMenu); } render.End(); }