protected override void Render(IGuiRenderer guiRenderer) { if (!string.IsNullOrEmpty(ImageName)) { guiRenderer.Image(ImageName, Size, margin: Margin); var imageSize = guiRenderer.GetImageSize(ImageName); var goodImageSize = IsGoodImageSize(imageSize); var textColour = goodImageSize ? Colours.White : Colours.Red; if (!goodImageSize) { guiRenderer.Line(new Vector2(0, 0), new Vector2(Size.X, Size.Y), Colours.Red); guiRenderer.Line(new Vector2(1, 1), new Vector2(Size.X + 1, Size.Y + 1), Colours.Red); guiRenderer.Line(new Vector2(Size.X, 0), new Vector2(0, Size.Y), Colours.Red); TooltipText = string.Format("Image is not a valid size ({0}, {1})", imageSize.X, imageSize.Y); } else { TooltipText = string.Format("{2} ({0}, {1})", imageSize.X, imageSize.Y, ImageName); } guiRenderer.Text("Arial", 12, FriendlyName, textColour, new Vector2(0, Size.Y)); } base.Render(guiRenderer); }
protected override void Render(IGuiRenderer guiRenderer) { if (ImageName != "") { guiRenderer.Image(ImageName, Size, margin: Margin); } if (IsMouseDown) { guiRenderer.Line(new Vector2(0, 0), new Vector2(20, 20), Colours.Red); } if (IsMouseOver) { guiRenderer.Line(new Vector2(5, 0), new Vector2(25, 20), Colours.Green); } if (Points != null) { if (Points.Length > 1) { for (var i = 0; i < Points.Length; i++) { var start = new Vector2(Points[i].X * Size.X, Points[i].Y * Size.Y); var endIndex = i == Points.Length - 1 ? 0 : i + 1; var end = new Vector2(Points[endIndex].X * Size.X, Points[endIndex].Y * Size.Y); guiRenderer.Line(start, end, Colours.Yellow); } } if (SelectedPointIndex.HasValue) { var selectedPointPosition = Points[SelectedPointIndex.Value].Scale(Size.X, Size.Y); guiRenderer.Rectangle( selectedPointPosition.Translate(-PointSelectorSquareSize, -PointSelectorSquareSize), selectedPointPosition.Translate(PointSelectorSquareSize, PointSelectorSquareSize), Colours.Green); } else if (HoverPointIndex.HasValue) { var hoverPointPosition = Points[HoverPointIndex.Value].Scale(Size.X, Size.Y); guiRenderer.Rectangle( hoverPointPosition.Translate(-PointSelectorSquareSize, -PointSelectorSquareSize), hoverPointPosition.Translate(PointSelectorSquareSize, PointSelectorSquareSize), Colours.LightBlue); } } base.Render(guiRenderer); }
protected override void Render(IGuiRenderer guiRenderer) { guiRenderer.Rectangle( new Vector2(0, 0), new Vector2(16, 16), guiRenderer.ColourScheme.ButtonBackground, guiRenderer.ColourScheme.ButtonSurround); if (Value) { guiRenderer.Line(new Vector2(0, 0), new Vector2(16, 16), guiRenderer.ColourScheme.ButtonSurround); guiRenderer.Line(new Vector2(16, 0), new Vector2(16, 0), guiRenderer.ColourScheme.ButtonSurround); } base.Render(guiRenderer); }