示例#1
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            var scrollbar = Children[0];

            scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y);

            Rectangle scissor = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width - 14, Height);

            if (ScissorStack.PushScissors(scissor))
            {
                batcher.EnableScissorTest(true);
                int  height    = 0;
                int  maxheight = _scrollBar.Value + Height;
                bool drawOnly1 = true;


                for (int i = 1; i < Children.Count; i++)
                {
                    Control child = Children[i];

                    if (!child.IsVisible)
                    {
                        continue;
                    }

                    child.Y = height - _scrollBar.Value /*+ (_isNormalScroll ? 20 : 0)*/;

                    if (height + child.Height <= _scrollBar.Value)
                    {
                        // do nothing
                    }
                    else if (height + child.Height <= maxheight)
                    {
                        child.Draw(batcher, x + child.X, y + child.Y);
                    }
                    else
                    {
                        if (drawOnly1)
                        {
                            child.Draw(batcher, x + child.X, y + child.Y);
                            drawOnly1 = false;
                        }
                    }

                    height += child.Height;
                }

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors();
            }

            return(true);
        }
示例#2
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Rectangle rectangle = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(rectangle))
            {
                batcher.EnableScissorTest(true);

                ResetHueVector();

                if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR)
                {
                    // draw regular world
                    _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                    batcher.End();

                    batcher.Begin(_xBR);
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                    batcher.End();

                    batcher.Begin();
                }
                else
                {
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                }


                // draw lights
                if (_scene.UseLights)
                {
                    batcher.SetBlendState(_blend);
                    batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _hueVector);
                    batcher.SetBlendState(null);
                }

                // draw overheads
                _scene.DrawSelection(batcher, x, y);
                _scene.DrawOverheads(batcher, x, y);

                base.Draw(batcher, x, y);

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors();
            }

            return(true);
        }
示例#3
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (DoScissor)
            {
                ScissorStack.PushScissors(new Rectangle(x, y, Width, Height));
                batcher.EnableScissorTest(true);
            }
            else
            {
                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors();
            }

            return(true);
        }
示例#4
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            var scrollbar = Children[0];

            scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y);

            Rectangle scissor = ScissorStack.CalculateScissors(Matrix.Identity, x + ScissorRectangle.X, y + ScissorRectangle.Y, (Width - 14) + ScissorRectangle.Width, Height + ScissorRectangle.Height);

            if (ScissorStack.PushScissors(scissor))
            {
                batcher.EnableScissorTest(true);
                int height = ScissorRectangle.Y;

                for (int i = 1; i < Children.Count; i++)
                {
                    Control child = Children[i];

                    if (!child.IsVisible)
                    {
                        continue;
                    }

                    child.Y = height - _scrollBar.Value;

                    if (height + child.Height <= _scrollBar.Value)
                    {
                        // do nothing
                    }
                    else
                    {
                        child.Draw(batcher, x + child.X, y + child.Y);
                    }

                    height += child.Height;
                }

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors();
            }

            return(true);
        }
示例#5
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ScrollBarBase scrollbar = (ScrollBarBase)Children[0];

            scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y);

            Rectangle scissor = ScissorStack.CalculateScissors
                                (
                Matrix.Identity,
                x + ScissorRectangle.X,
                y + ScissorRectangle.Y,
                Width - 14 + ScissorRectangle.Width,
                Height + ScissorRectangle.Height
                                );

            if (ScissorStack.PushScissors(batcher.GraphicsDevice, scissor))
            {
                batcher.EnableScissorTest(true);

                for (int i = 1; i < Children.Count; i++)
                {
                    Control child = Children[i];

                    if (!child.IsVisible)
                    {
                        continue;
                    }

                    int finalY = y + child.Y - scrollbar.Value + ScissorRectangle.Y;

                    //if (finalY + child.Bounds.Height >= scissor.Y && finalY - child.Height < scissor.Bottom)
                    {
                        child.Draw(batcher, x + child.X, finalY);
                    }
                }

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors(batcher.GraphicsDevice);
            }

            return(true);
        }
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (IsDisposed)
            {
                return(false);
            }

            ResetHueVector();

            Rectangle scissor = ScissorStack.CalculateScissors
                                (
                Matrix.Identity,
                x,
                y,
                Width,
                Height
                                );

            if (ScissorStack.PushScissors(batcher.GraphicsDevice, scissor))
            {
                batcher.EnableScissorTest(true);
                base.Draw(batcher, x, y);

                _gameText.Draw
                (
                    batcher,
                    Width + ScrollX,
                    Height + ScrollY,
                    x,
                    y,
                    Width,
                    Height,
                    ScrollX,
                    ScrollY
                );

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors(batcher.GraphicsDevice);
            }

            return(true);
        }
示例#7
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

            var rect = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(rect))
            {
                ShaderHuesTraslator.GetHueVector(ref _hueVector, 0, false, Alpha, true);

                batcher.EnableScissorTest(true);

                DrawInternal(batcher, x, y, ref _hueVector);
                base.Draw(batcher, x, y);

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors();

                return(true);
            }

            return(false);
        }
示例#8
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            base.Draw(batcher, x, y);
            Rectangle scissor = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(batcher.GraphicsDevice, scissor))
            {
                batcher.EnableScissorTest(true);
                RenderedText t         = _bookPage.renderedText;
                int          startpage = (ActivePage - 1) * 2;

                if (startpage < BookPageCount)
                {
                    int poy = _bookPage._pageCoords[startpage, 0], phy = _bookPage._pageCoords[startpage, 1];
                    _bookPage.DrawSelection(batcher, x + RIGHT_X, y + UPPER_MARGIN, poy, poy + phy);
                    t.Draw(batcher, x + RIGHT_X, y + UPPER_MARGIN, 0, poy, t.Width, phy);

                    if (startpage == _bookPage._caretPage)
                    {
                        if (_bookPage._caretPos.Y < poy + phy)
                        {
                            if (_bookPage._caretPos.Y >= poy)
                            {
                                if (_bookPage.HasKeyboardFocus)
                                {
                                    _bookPage.renderedCaret.Draw
                                    (
                                        batcher, _bookPage._caretPos.X + x + RIGHT_X,
                                        _bookPage._caretPos.Y + y + UPPER_MARGIN - poy, 0, 0,
                                        _bookPage.renderedCaret.Width, _bookPage.renderedCaret.Height
                                    );
                                }
                            }
                            else
                            {
                                _bookPage._caretPage = _bookPage.GetCaretPage();
                            }
                        }
                        else if (_bookPage._caretPos.Y <= _bookPage.Height)
                        {
                            if (_bookPage._caretPage + 2 < _bookPage._pagesChanged.Length)
                            {
                                _bookPage._focusPage = _bookPage._caretPage++;
                                SetActivePage(_bookPage._caretPage / 2 + 2);
                            }
                        }
                    }
                }

                startpage--;

                if (startpage > 0)
                {
                    int poy = _bookPage._pageCoords[startpage, 0], phy = _bookPage._pageCoords[startpage, 1];
                    _bookPage.DrawSelection(batcher, x + LEFT_X, y + UPPER_MARGIN, poy, poy + phy);
                    t.Draw(batcher, x + LEFT_X, y + UPPER_MARGIN, 0, poy, t.Width, phy);

                    if (startpage == _bookPage._caretPage)
                    {
                        if (_bookPage._caretPos.Y < poy + phy)
                        {
                            if (_bookPage._caretPos.Y >= poy)
                            {
                                if (_bookPage.HasKeyboardFocus)
                                {
                                    _bookPage.renderedCaret.Draw
                                    (
                                        batcher, _bookPage._caretPos.X + x + LEFT_X,
                                        _bookPage._caretPos.Y + y + UPPER_MARGIN - poy, 0, 0,
                                        _bookPage.renderedCaret.Width, _bookPage.renderedCaret.Height
                                    );
                                }
                            }
                            else if (_bookPage._caretPage > 0)
                            {
                                _bookPage._focusPage = _bookPage._caretPage--;
                                SetActivePage(_bookPage._caretPage / 2 + 1);
                            }
                        }
                        else if (_bookPage._caretPos.Y <= _bookPage.Height)
                        {
                            if (_bookPage._caretPage + 2 < _bookPage._pagesChanged.Length)
                            {
                                _bookPage._caretPage++;
                            }
                        }
                    }
                }

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors(batcher.GraphicsDevice);
            }

            return(true);
        }
示例#9
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_scene.ViewportTexture == null)
            {
                return(false);
            }

            Rectangle rectangle = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(batcher.GraphicsDevice, rectangle))
            {
                batcher.EnableScissorTest(true);

                ResetHueVector();

                if (ProfileManager.Current != null && ProfileManager.Current.UseXBR)
                {
                    // draw regular world
                    if (_xBR == null)
                    {
                        _xBR = new XBREffect(batcher.GraphicsDevice);
                    }

                    _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                    batcher.End();

                    batcher.Begin(_xBR);
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                    batcher.End();

                    batcher.Begin();
                }
                else
                {
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                }


                // draw lights
                // if (_scene.UseAltLights)
                // {
                //     batcher.SetBlendState(_altLightsBlend);
                //     _hueVector.Z = 0.5f;
                //     batcher.Draw2D(_scene.LightRenderTarget, x, y, Width, Height, ref _hueVector);
                //     _hueVector.Z = 0;
                //     batcher.SetBlendState(null);
                // }
                // else if (_scene.UseLights)
                // {
                //     batcher.SetBlendState(_darknessBlend);
                //     batcher.Draw2D(_scene.LightRenderTarget, x, y, Width, Height, ref _hueVector);
                //     batcher.SetBlendState(null);
                // }

                // draw overheads
                _scene.DrawSelection(batcher, x, y);
                _scene.DrawOverheads(batcher, x, y);

                base.Draw(batcher, x, y);

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors(batcher.GraphicsDevice);
            }

            return(true);
        }