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 override void Draw(SpriteBatch sb, Game game, float elapsedSeconds) { Rectangle screen = Root.Screen; Primitives.FillRectangle(screen, Color.FromNonPremultiplied(0, 0, 0, 150)); Player.Draw(sb, rectVideo, alreadyFullscreen: true); Primitives.DrawRectangle(new Rectangle(rectVideo.X - 2, rectVideo.Y - 2, rectVideo.Width + 4, rectVideo.Height + 4), Color.White, 2); base.Draw(sb, game, elapsedSeconds); }
public override void Draw() { IsMouseOverThis = Root.IsMouseOver(Rectangle); bool pressed = IsMouseOverThis && Root.Mouse_NewState.LeftButton == ButtonState.Pressed; Color outerBorderColor = IsMouseOverThis ? Skin.OuterBorderColorMouseOver : Skin.OuterBorderColor; Color innerBorderColor = pressed ? Skin.InnerBorderColorMousePressed : (IsMouseOverThis ? Skin.InnerBorderColorMouseOver : Skin.InnerBorderColor); Color innerButtonColor = IsMouseOverThis ? Skin.GreyBackgroundColorMouseOver: Skin.GreyBackgroundColor; Color textColor = IsMouseOverThis ? Skin.TextColorMouseOver : Skin.TextColor; Primitives.FillRectangle(Rectangle, innerBorderColor); Primitives.DrawRectangle(Rectangle, outerBorderColor, Skin.OuterBorderThickness); Primitives.DrawAndFillRectangle(InnerRectangleWithBorder, innerButtonColor, outerBorderColor, Skin.OuterBorderThickness); Primitives.DrawMultiLineText(Caption, InnerRectangle, textColor, Skin.Font, Primitives.TextAlignment.Middle); }
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 static void DrawImage(Texture2D texture, Rectangle rectangle, Color?color = null, bool scale = false, bool scaleUp = true, Color?scaleBgColor = null) { Color clr = color ?? Color.White; if (scale) { Color clrB = scaleBgColor ?? Color.Black; Primitives.FillRectangle(rectangle, clrB); SpriteBatch.Draw(texture, Utilities.ScaleRectangle(rectangle, texture.Width, texture.Height, scaleUp), clr); } else { SpriteBatch.Draw(texture, rectangle, clr); } }
public override void Draw() { string txt = Text; if (IsPassword) { txt = ""; for (int i = 0; i < Text.Length; i++) { txt += "*"; } } Color outerBorderColor = Skin.OuterBorderColor; Color innerBorderColor = Skin.InnerBorderColor; Color innerButtonColor = Skin.WhiteBackgroundColor; Color textColor = Skin.TextColor; Primitives.FillRectangle(Rectangle, Color.FromNonPremultiplied(226, 187, 50, 255));//Color.White); Primitives.DrawRectangle(Rectangle, Color.Black, 2); // Primitives.DrawAndFillRectangle(InnerRectangleWithBorder, innerButtonColor, outerBorderColor, Skin.OuterBorderThickness); Primitives.DrawMultiLineText(txt + ((int)(Root.SecondsSinceStart * 2) % 2 == 0 && IsActive ? "|" : ""), new Rectangle(Rectangle.X + 8, Rectangle.Y + 3 + 2, Rectangle.Width - 10, Rectangle.Height - 4), textColor, Library.FontConsoleNormal, Primitives.TextAlignment.TopLeft); }
public virtual void Draw() { Primitives.FillRectangle(Rectangle, Color.Red); }
/// <summary> /// Draws the video player. /// </summary> /// <param name="sb">Spritebatch to use.</param> /// <param name="rect">Rectangle to fill.</param> /// <param name="alreadyFullscreen">Is the video player part of the FullscreenVideoGamePhase?</param> public void Draw(SpriteBatch sb, Rectangle rect, bool alreadyFullscreen = false) { mouseOverFullscreenButton = false; mouseOverPlayPauseButton = false; mouseOverStopButton = false; mouseOverThisElement = false; if (State == MediaState.Playing || State == MediaState.Paused) { Texture2D tex = this.GetTexture(); if (tex != null) { Primitives.DrawImage(tex, rect, Color.White, scale: PerformScaling, scaleUp: false, scaleBgColor: Color.Black); } else { Primitives.FillRectangle(rect, Color.DarkGreen); } } else { if (stoppedTexture != null) { Primitives.DrawImage(stoppedTexture, rect, Color.White, scale: PerformScaling, scaleUp: false, scaleBgColor: Color.Black); } else { Primitives.FillRectangle(rect, Color.Black); } } if (Root.IsMouseOver(rect)) { mouseOverThisElement = true; Color clrSemitransparent = Color.FromNonPremultiplied(255, 255, 255, 150); Rectangle rectBottom = new Rectangle(rect.X, rect.Bottom - 5, rect.Width, 5); Primitives.FillRectangle(rectBottom, Color.Gray); double percent = videoPlayer.PlayPosition.TotalSeconds / videoPlayer.Video.Duration.TotalSeconds; Primitives.FillRectangle(new Rectangle(rectBottom.X, rectBottom.Y, (int)(rectBottom.Width * percent), rectBottom.Height), Color.White); const int ICONSIZE = 30; Rectangle rectPlayPause = new Rectangle(rectBottom.X + 1, rectBottom.Bottom - 1 - ICONSIZE, ICONSIZE, ICONSIZE); Rectangle rectStop = new Rectangle(rectBottom.X + ICONSIZE + 1, rectBottom.Bottom - 1 - ICONSIZE, ICONSIZE, ICONSIZE); Rectangle rectFullscreen = new Rectangle(rectBottom.Right - ICONSIZE - 1, rectBottom.Bottom - 1 - ICONSIZE, ICONSIZE, ICONSIZE); if (hasPlayPauseButton) { Texture2D icon = videoPlayer.State == MediaState.Playing ? Library.IconPause : Library.IconPlay; mouseOverPlayPauseButton = Root.IsMouseOver(rectPlayPause); sb.Draw(icon, rectPlayPause, mouseOverPlayPauseButton ? Color.White : clrSemitransparent); if (State == MediaState.Playing || State == MediaState.Paused) { mouseOverStopButton = Root.IsMouseOver(rectStop); sb.Draw(Library.IconStop, rectStop, mouseOverStopButton ? Color.White : clrSemitransparent); } } if (hasExtendToFullscreenButton && !alreadyFullscreen) { mouseOverFullscreenButton = Root.IsMouseOver(rectFullscreen); sb.Draw(Library.IconFullscreen, rectFullscreen, mouseOverFullscreenButton ? Color.White : clrSemitransparent); } if (onClickPlayPause) { sb.Draw(videoPlayer.State == MediaState.Playing ? Library.IconPause : Library.IconPlay, new Rectangle(rect.X + rect.Width / 2 - 30, rect.Y + rect.Height / 2 - 30, 60, 60), clrSemitransparent); } if (onClickExtendToFullscreen && !alreadyFullscreen) { sb.Draw(Library.IconFullscreen, new Rectangle(rect.X + rect.Width / 2 - 30, rect.Y + rect.Height / 2 - 30, 60, 60), clrSemitransparent); } } }