public void Draw(SpriteBatchUI sb, RectInt destRectangle, int xScroll, int yScroll, Vector3?hueVector = null) { if (string.IsNullOrEmpty(Text)) { return; } var sourceRectangle = new RectInt(); if (xScroll > Width || xScroll < -MaxWidth || yScroll > Height || yScroll < -Height) { return; } sourceRectangle.x = xScroll; sourceRectangle.y = yScroll; var maxX = sourceRectangle.x + destRectangle.width; if (maxX <= Width) { sourceRectangle.width = destRectangle.width; } else { sourceRectangle.width = Width - sourceRectangle.x; destRectangle.width = sourceRectangle.width; } var maxY = sourceRectangle.y + destRectangle.height; if (maxY <= Height) { sourceRectangle.height = destRectangle.height; } else { sourceRectangle.height = Height - sourceRectangle.y; destRectangle.height = sourceRectangle.height; } sb.Draw2D(Texture, destRectangle, sourceRectangle, hueVector.HasValue ? hueVector.Value : Vector3.zero); for (var i = 0; i < _document.Links.Count; i++) { var link = _document.Links[i]; if (ClipRectangle(new Vector2Int(xScroll, yScroll), link.Area, destRectangle, out Vector2Int pos, out RectInt srcRect)) { // only draw the font in a different color if this is a HREF region. // otherwise it is a dummy region used to notify images that they are // being mouse overed. if (link.HREF != null) { var linkHue = 0; if (link.Index == MouseOverRegionID) { if (IsMouseDown) { linkHue = link.Style.ActiveColorHue; } else { linkHue = link.Style.HoverColorHue; } } else { linkHue = link.Style.ColorHue; } sb.Draw2D(Texture, new Vector3(pos.x, pos.y, 0), srcRect, Utility.GetHueVector(linkHue)); } } } for (var i = 0; i < _document.Images.Count; i++) { var img = _document.Images[i]; if (ClipRectangle(new Vector2Int(xScroll, yScroll), img.Area, destRectangle, out Vector2Int position, out RectInt srcRect)) { var srcImage = new RectInt(srcRect.x - img.Area.X, srcRect.y - img.Area.Y, srcRect.width, srcRect.height); Texture2DInfo texture = null; // is the mouse over this image? if (img.LinkIndex != -1 && img.LinkIndex == MouseOverRegionID) { if (IsMouseDown) { texture = img.TextureDown; } if (texture == null) { texture = img.TextureOver; } if (texture == null) { texture = img.Texture; } } if (texture == null) { texture = img.Texture; } if (srcImage.width > texture.Width) { srcImage.width = texture.Width; } if (srcImage.height > texture.Height) { srcImage.height = texture.Height; } sb.Draw2D(texture, new Vector3(position.x, position.y, 0), srcImage, Utility.GetHueVector(0, false, false, true)); } } }
public override bool Draw(SpriteBatchUI spriteBatch, Point position, Vector3?hue = null) { return(spriteBatch.Draw2D(TransparentTexture, new Rectangle(position.X, position.Y, Width, Height), ShaderHuesTraslator.GetHueVector(0, false, .5f, false))); }
public override bool Draw(SpriteBatchUI spriteBatch, Vector3 position, Vector3?hue = null) { return(spriteBatch.Draw2D(TransparentTexture, new Rectangle((int)position.X, (int)position.Y, Width, Height), RenderExtentions.GetHueVector(0, false, .5f, true))); }
public override void Draw(SpriteBatchUI spriteBatch) { spriteBatch.Draw2D(m_texture, Position, 0, false, false); base.Draw(spriteBatch); }
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS) { base.Draw(spriteBatch, position, frameMS); spriteBatch.Draw2D(((WorldView)m_World.GetView()).MiniMap.Texture, new Vector3(position.X + 8, position.Y + 8, 0), Vector3.Zero); }
public void Draw(SpriteBatchUI sb, Point position) { Vector3 v = new Vector3(position.X - m_Offset.X, position.Y - m_Offset.Y, 0); sb.Draw2D(m_Texture, v, m_SourceRect, Utility.GetHueVector(m_Hue)); }
public override void Draw(SpriteBatchUI spriteBatch) { m_texture = ASCIIText.GetTextTexture(Text, FontID); spriteBatch.Draw2D(m_texture, Position, Hue, true, false); base.Draw(spriteBatch); }
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS) { spriteBatch.Draw2D(m_texture, new Vector3(position.X, position.Y, 0), Utility.GetHueVector(0, false, false, true)); base.Draw(spriteBatch, position, frameMS); }