Beispiel #1
0
        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);
        }