示例#1
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);

            if (batcher.ClipBegin(x + ScissorRectangle.X, y + ScissorRectangle.Y, Width - 14 + ScissorRectangle.Width, Height + ScissorRectangle.Height))
            {
                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;

                    child.Draw(batcher, x + child.X, finalY);
                }

                batcher.ClipEnd();
            }

            return(true);
        }
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (DoScissor)
            {
                batcher.ClipBegin(x, y, Width, Height);
            }
            else
            {
                batcher.ClipEnd();
            }

            return(true);
        }
示例#3
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (batcher.ClipBegin(x, y, Width, Height))
            {
                Vector3 hueVector = ShaderHueTranslator.GetHueVector
                                    (
                    0,
                    false,
                    Alpha,
                    true
                                    );

                DrawInternal(batcher, x, y, hueVector);
                base.Draw(batcher, x, y);

                batcher.ClipEnd();
            }

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

            if (batcher.ClipBegin(x, y, Width, Height))
            {
                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.ClipEnd();
            }

            return(true);
        }