public override void Draw() { MouseOverIndex = -1; Color outerBorderColor = Skin.OuterBorderColor; Color innerBorderColor = Skin.InnerBorderColor; Color innerButtonColor = Skin.WhiteBackgroundColor; Color textColor = Skin.TextColor; Primitives.FillRectangle(Rectangle, innerBorderColor); Primitives.DrawRectangle(Rectangle, outerBorderColor, Skin.OuterBorderThickness); Primitives.DrawAndFillRectangle(InnerRectangleWithBorder, innerButtonColor, outerBorderColor, Skin.OuterBorderThickness); // Primitives.DrawMultiLineText(txt + (Root.SecondsSinceStartInt % 2 == 0 ? "|" : ""), new Rectangle(InnerRectangle.X + 8, InnerRectangle.Y + 3, InnerRectangle.Width - 10, InnerRectangle.Height - 4), textColor, Skin.Font, Primitives.TextAlignment.TopLeft); for (int i = _topOfList; i < Items.Count; i++) { Rectangle rectItem = new Rectangle(InnerRectangle.X + 1, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList) + 1, InnerRectangle.Width - 2, Skin.ListItemHeight); if (Root.IsMouseOver(rectItem)) { MouseOverIndex = i; } if (_selectedIndex == i) { Primitives.FillRectangle(rectItem, Skin.ItemSelectedBackgroundColor); } else if (MouseOverIndex == i) { Primitives.FillRectangle(rectItem, Skin.ItemMouseOverBackgroundColor); } Primitives.DrawSingleLineText(Items[i].ToString(), new Vector2(InnerRectangle.X + 5, InnerRectangle.Y + 2 + Skin.ListItemHeight * (i - _topOfList)), Skin.TextColor, Skin.Font); Primitives.DrawLine(new Vector2(InnerRectangle.X, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList + 1)), new Vector2(InnerRectangle.Right, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList + 1)), outerBorderColor, Skin.OuterBorderThickness); } }
public void Draw() { Rectangle rect = new Rectangle(0, (int)Y, Root.ScreenWidth, TOAST_HEIGHT); Primitives.FillRectangle(rect, Color.FromNonPremultiplied(170, 170, 170, (int)(AlphaMax * Alpha))); int text_x = rect.X + 7; if (Icon != GUIIcon.None) { int iconheight = TOAST_HEIGHT - 6; Primitives.DrawImage(Library.GetTexture2DFromGUIIcon(Icon), new Rectangle(text_x, rect.Y + 2, iconheight, iconheight), Color.FromNonPremultiplied(255, 255, 255, (int)(AlphaMax * Alpha))); text_x += iconheight + 7; } Primitives.DrawSingleLineText(Text, new Vector2(text_x, rect.Y + 6), Color.FromNonPremultiplied(ForeColor.R, ForeColor.G, ForeColor.B, (int)(Alpha * AlphaMax))); }
public override void Draw(SpriteBatch sb, Game game, float elapsedSeconds) { Rectangle rectBox = new Rectangle(TopLeftX, TopLeftY, Width, Height); Rectangle rectTitle = new Rectangle(TopLeftX, TopLeftY, Width, 28); Primitives.DrawAndFillRectangle(rectBox, Skin.DialogBackgroundColor, Skin.OuterBorderColor, Skin.OuterBorderThickness); Primitives.DrawAndFillRectangle(rectTitle, Skin.InnerBorderColor, Skin.OuterBorderColor, Skin.OuterBorderThickness); Primitives.DrawSingleLineText(Caption, new Vector2(TopLeftX + 5, TopLeftY + 3), Skin.TextColor, Skin.Font); if (Icon != GUIIcon.None) { sb.Draw(Library.GetTexture2DFromGUIIcon(Icon), new Rectangle(rectBox.X + 5, rectBox.Y + 60, 45, 45), Color.White); } Primitives.DrawMultiLineText(Text, new Rectangle(rectBox.X + 55, rectBox.Y + 50, rectBox.Width - 65, rectBox.Height - 40), Skin.TextColor, Skin.Font, Primitives.TextAlignment.Top); foreach (Button b in Buttons) { b.Draw(); } base.Draw(sb, game, elapsedSeconds); }