public override bool Draw(SpriteBatchUI spriteBatch, Point position, Vector3?hue = null) { Children[0].Draw(spriteBatch, new Point(position.X + Children[0].X, position.Y + Children[0].Y)); _rect.X = position.X; _rect.Y = position.Y; _rect.Width = Width; _rect.Height = Height; Rectangle scissor = ScissorStack.CalculateScissors(spriteBatch.TransformMatrix, _rect); if (ScissorStack.PushScissors(scissor)) { spriteBatch.EnableScissorTest(true); int height = 0; int maxheight = _scrollBar.Value + _scrollBar.Height; bool drawOnly1 = true; for (int i = 1; i < Children.Count; i++) { GumpControl child = Children[i]; if (!child.IsVisible) { continue; } child.Y = height - _scrollBar.Value; if (height + child.Height <= _scrollBar.Value) { // do nothing } else if (height + child.Height <= maxheight) { child.Draw(spriteBatch, new Point(position.X + child.X, position.Y + child.Y)); } else { if (drawOnly1) { child.Draw(spriteBatch, new Point(position.X + child.X, position.Y + child.Y)); drawOnly1 = false; } } height += child.Height; } spriteBatch.EnableScissorTest(false); ScissorStack.PopScissors(); } return(true); }
public override bool Draw(SpriteBatchUI spriteBatch, Vector3 position, Vector3?hue = null) { int height = 0; int maxheight = _scrollBar.Value + _scrollBar.Height; for (int i = 0; i < Children.Count; i++) { GumpControl child = Children[i]; if (child is IScrollBar) { child.Draw(spriteBatch, new Vector3(position.X + child.X, position.Y + child.Y, 0)); } else { child.Y = height - _scrollBar.Value; if (height + child.Height <= _scrollBar.Value) { // do nothing } else if (height + child.Height <= maxheight) { if (child.Y < 0) { // TODO: Future implementation } else { child.Draw(spriteBatch, new Vector3(position.X + child.X, position.Y + child.Y, 0)); } } height += child.Height; } } return(true); }