protected override void Draw() { CroppedBox box = default(CroppedBox); Vector2 size = (cachedSize - cachedPadding), halfSize = size * .5f; box.bounds = new BoundingBox2(cachedPosition - halfSize, cachedPosition + halfSize); box.mask = maskingBox; if (hudBoard.Color.A > 0) { hudBoard.Draw(ref box, ref HudSpace.PlaneToWorldRef[0]); } // Left align the tab Vector2 tabPos = cachedPosition, tabSize = new Vector2(4f, size.Y - cachedPadding.Y); tabPos.X += (-size.X + tabSize.X) * .5f; tabSize *= .5f; if (CanDrawTab && tabBoard.Color.A > 0) { box.bounds = new BoundingBox2(tabPos - tabSize, tabPos + tabSize); tabBoard.Draw(ref box, ref HudSpace.PlaneToWorldRef[0]); } }
protected override void Draw() { if (hudBoard.Color.A > 0) { CroppedBox box = default(CroppedBox); Vector2 halfSize = (cachedSize - cachedPadding) * .5f; box.bounds = new BoundingBox2(cachedPosition - halfSize, cachedPosition + halfSize); box.mask = maskingBox; hudBoard.Draw(ref box, HudSpace.PlaneToWorldRef); } }
protected override void Draw() { if (Color.A > 0) { CroppedBox box = default(CroppedBox); box.mask = maskingBox; float thickness = _thickness, height = cachedSize.Y - cachedPadding.Y, width = cachedSize.X - cachedPadding.X; Vector2 halfSize, pos; // Left halfSize = new Vector2(thickness, height) * .5f; pos = cachedPosition + new Vector2((-width + thickness) * .5f, 0f); box.bounds = new BoundingBox2(pos - halfSize, pos + halfSize); hudBoard.Draw(ref box, HudSpace.PlaneToWorldRef); // Top halfSize = new Vector2(width, thickness) * .5f; pos = cachedPosition + new Vector2(0f, (height - thickness) * .5f); box.bounds = new BoundingBox2(pos - halfSize, pos + halfSize); hudBoard.Draw(ref box, HudSpace.PlaneToWorldRef); // Right halfSize = new Vector2(thickness, height) * .5f; pos = cachedPosition + new Vector2((width - thickness) * .5f, 0f); box.bounds = new BoundingBox2(pos - halfSize, pos + halfSize); hudBoard.Draw(ref box, HudSpace.PlaneToWorldRef); // Bottom halfSize = new Vector2(width, thickness) * .5f; pos = cachedPosition + new Vector2(0f, (-height + thickness) * .5f); box.bounds = new BoundingBox2(pos - halfSize, pos + halfSize); hudBoard.Draw(ref box, HudSpace.PlaneToWorldRef); } }
public void Draw(MatBoard matBoard, Vector2 origin, Vector2 tbOffset, Vector2 xBounds, ref MatrixD matrix) { CroppedBox box = default(CroppedBox); Vector2 clipSize, clipPos; clipSize = size; clipPos = offset + tbOffset; // Determine the visible extents of the highlight box within the bounds of the textboard float leftBound = Math.Max(clipPos.X - clipSize.X * .5f, xBounds.X), rightBound = Math.Min(clipPos.X + clipSize.X * .5f, xBounds.Y); // Adjust highlight size and offset to compensate for textboard clipping and offset clipSize.X = Math.Max(0, rightBound - leftBound); clipPos.X = (rightBound + leftBound) * .5f; clipPos += origin; clipSize *= .5f; box.bounds = new BoundingBox2(clipPos - clipSize, clipPos + clipSize); matBoard.Draw(ref box, ref matrix); }