Beispiel #1
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            if (_renderedTexture == null)
            {
                Color[] data = new Color[Width * Height];
                for (int h = 0; h < Height; h++)
                {
                    int i = h % 2;
                    for (int w = 0; w < Width; w++)
                    {
                        if (i++ >= 1)
                        {
                            data[h * Width + w] = Color.Black;
                            i = 0;
                        }
                        else
                        {
                            data[h * Width + w] = Color.Transparent;
                        }
                    }
                }
                _renderedTexture = new Texture2D(spriteBatch.GraphicsDevice, Width, Height);
                _renderedTexture.SetData<Color>(data);
            }

            // spriteBatch.Flush();
            // spriteBatch.Begin(SpriteBlendMode.None); !!!
            spriteBatch.Draw2D(_renderedTexture, new Rectangle(X, Y, Width, Area.Height), new Rectangle(0, 0, Area.Width, Area.Height), 0, false, false);
            // spriteBatch.Flush();

            base.Draw(spriteBatch);
        }
Beispiel #2
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     spriteBatch.Draw2D(_gumpBar[0], Position, 0, false, false);
     spriteBatch.Draw2DTiled(_gumpBar[1], new Rectangle(Area.X + _gumpBar[0].Width, Area.Y, BarWidth - _gumpBar[2].Width - _gumpBar[0].Width, _gumpBar[1].Height), 0, false, false);
     spriteBatch.Draw2D(_gumpBar[2], new Point2D(Area.X + BarWidth - _gumpBar[2].Width, Area.Y), 0, false, false);
     spriteBatch.Draw2D(_gumpSlider, new Point2D(Area.X + _sliderX, Area.Y), 0, false, false);
     base.Draw(spriteBatch);
 }
Beispiel #3
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (_texture == null)
     {
         _texture = Data.Art.GetStaticTexture(_item.DisplayItemID);
         Size = new Point2D(_texture.Width, _texture.Height);
     }
     spriteBatch.Draw2D(_texture, Position, _item.Hue, false, false);
     base.Draw(spriteBatch);
 }
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (_texture == null)
     {
         if (IsFemale)
             _texture = Data.Gumps.GetGumpXNA(Item.ItemData.Animation + 60000);
         if (_texture == null)
             _texture = Data.Gumps.GetGumpXNA(Item.ItemData.Animation + 50000);
         Size = new Point2D(_texture.Width, _texture.Height);
     }
     spriteBatch.Draw2D(_texture, Position, Item.Hue & 0x7FFF, (Item.Hue & 0x8000) == 0x8000 ? true : false, false);
     base.Draw(spriteBatch);
 }
Beispiel #5
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            int centerWidth = Width - _bgGumps[0].Width - _bgGumps[2].Width;
            int centerHeight = Height - _bgGumps[0].Height - _bgGumps[2].Height;
            int line2Y = Y + _bgGumps[0].Height;
            int line3Y = Y + Height - _bgGumps[6].Height;

            spriteBatch.Draw2D(_bgGumps[0], new Point2D(X, Y), 0, false, false);
            spriteBatch.Draw2DTiled(_bgGumps[1], new Rectangle(X + _bgGumps[0].Width, Y, centerWidth, _bgGumps[0].Height), 0, false, false);
            spriteBatch.Draw2D(_bgGumps[2], new Point2D(X + Width - _bgGumps[2].Width, Y), 0, false, false);

            spriteBatch.Draw2DTiled(_bgGumps[3], new Rectangle(X, line2Y, _bgGumps[0].Width, centerHeight), 0, false, false);
            spriteBatch.Draw2DTiled(_bgGumps[4], new Rectangle(X + _bgGumps[0].Width, line2Y, centerWidth, centerHeight), 0, false, false);
            spriteBatch.Draw2DTiled(_bgGumps[5], new Rectangle(X + Width - _bgGumps[2].Width, line2Y, _bgGumps[2].Width, centerHeight), 0, false, false);

            spriteBatch.Draw2D(_bgGumps[6], new Point2D(X, line3Y), 0, false, false);
            spriteBatch.Draw2DTiled(_bgGumps[7], new Rectangle(X + _bgGumps[0].Width, line3Y, centerWidth, _bgGumps[6].Height), 0, false, false);
            spriteBatch.Draw2D(_bgGumps[8], new Point2D(X + Width - _bgGumps[2].Width, line3Y), 0, false, false);

            base.Draw(spriteBatch);
        }
Beispiel #6
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     // up button
     spriteBatch.Draw2D(_btnUpClicked ? _gumpUpButton[1] : _gumpUpButton[0], new Point2D(X, Y), 0, false, false);
     // scrollbar background
     spriteBatch.Draw2D(_gumpBackground[0], new Point2D(X, Y + _gumpUpButton[0].Height), 0, false, false);
     int middlewidth = BarHeight - _gumpUpButton[0].Height - _gumpDownButton[0].Height - _gumpBackground[0].Height - _gumpBackground[2].Height;
     spriteBatch.Draw2DTiled(_gumpBackground[1], new Rectangle(X, Y + _gumpUpButton[0].Height + _gumpBackground[0].Height, _gumpBackground[0].Width, middlewidth), 0, false, false);
     spriteBatch.Draw2D(_gumpBackground[2], new Point2D(X, Y + BarHeight - _gumpDownButton[0].Height - _gumpBackground[2].Height), 0, false, false);
     // down button
     spriteBatch.Draw2D(_btnDownClicked ? _gumpDownButton[1] : _gumpDownButton[0], new Point2D(X, Y + Height - _gumpDownButton[0].Height), 0, false, false);
     // slider
     spriteBatch.Draw2D(_gumpSlider, new Point2D(X + (_gumpBackground[0].Width - _gumpSlider.Width) / 2, Y + _gumpUpButton[0].Height + 1 + (int)_sliderY), 0, false, false);
     base.Draw(spriteBatch);
 }
Beispiel #7
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (_isAnOpenSwatch)
     {
         spriteBatch.Draw2D(_huesTexture, Area, 0, false, false);
         spriteBatch.Draw2D(_selectedIndicator, new Point2D(
             (int)(X + (float)(Width / _hueSize.X) * ((Index % _hueSize.X) + 0.5f) - _selectedIndicator.Width / 2),
             (int)(Y + (float)(Height / _hueSize.Y) * ((Index / _hueSize.X) + 0.5f) - _selectedIndicator.Height / 2)
             ), 0, false, false);
     }
     else
     {
         if (!_isSwatchOpen)
             spriteBatch.Draw2D(_huesTexture, Area, 0, false, false);
     }
     base.Draw(spriteBatch);
 }
Beispiel #8
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            if (_background)
            {
                if (_backgroundTexture == null)
                {
                    _backgroundTexture = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
                    _backgroundTexture.SetData<Color>(new Color[] { Color.White });
                }
                spriteBatch.Draw2D(_backgroundTexture, new Rectangle(OwnerX + Area.X, OwnerY + Area.Y, Width, Height), 0, false, false);
            }

            _textRenderer.ActiveHREF = _hrefOver;
            _textRenderer.ActiveHREF_UseDownHue = _clicked;
            _textRenderer.Draw(spriteBatch, new Rectangle(X, Y, Size.X, Size.Y), ScrollX, ScrollY);

            base.Draw(spriteBatch);
        }
Beispiel #9
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            _textRenderer.Draw(spriteBatch, Position);
            if (_caratBlinkOn)
                _caratRenderer.Draw(spriteBatch, new Point2D(X + _textRenderer.Width, Y));

            base.Draw(spriteBatch);
        }
Beispiel #10
0
        public void Draw(SpriteBatchUI sb, Rectangle destRectangle, int xScroll, int yScroll)
        {
            checkRender(sb.GraphicsDevice);

            Rectangle sourceRectangle;

            if (xScroll > _texture.Width)
                return;
            else if (xScroll < -MaxWidth)
                return;
            else
                sourceRectangle.X = xScroll;

            if (yScroll > _texture.Height)
                return;
            else if (yScroll < - Height)
                return;
            else
                sourceRectangle.Y = yScroll;

            int maxX = sourceRectangle.X + destRectangle.Width;
            if (maxX <= _texture.Width)
                sourceRectangle.Width = destRectangle.Width;
            else
            {
                sourceRectangle.Width = _texture.Width - sourceRectangle.X;
                destRectangle.Width = sourceRectangle.Width;
            }

            int maxY = sourceRectangle.Y + destRectangle.Height;
            if (maxY <= _texture.Height)
            {
                sourceRectangle.Height = destRectangle.Height;
            }
            else
            {
                sourceRectangle.Height = _texture.Height - sourceRectangle.Y;
                destRectangle.Height = sourceRectangle.Height;
            }

            sb.Draw2D(_texture, destRectangle, sourceRectangle, hueButNotIfHTML, false, _hueTransparent);

            foreach (HTMLRegion r in _href.Regions)
            {
                Point2D position;
                Rectangle sourceRect;
                if (clipRectangle(new Point2D(xScroll, yScroll), r.Area, destRectangle, out position, out sourceRect))
                {
                    // only draw the font in a different color if this is a HREF region.
                    // otherwise it is a dummy region used to notify images that they are
                    // being mouse overed.
                    if (r.HREFAttributes != null)
                    {
                        int hue = 0;
                        if (r.Index == _activeHREF)
                            if (_activeHREF_usedownhue)
                                hue = r.HREFAttributes.DownHue;
                            else
                                hue = r.HREFAttributes.OverHue;
                        else
                            hue = r.HREFAttributes.UpHue;

                        sb.Draw2D(_texture, position,
                            sourceRect, hue, false, false);
                    }
                }
            }

            foreach (HTMLImage image in _images.Images)
            {
                Point2D position;
                Rectangle sourceRect;
                if (clipRectangle(new Point2D(xScroll, yScroll), image.Area, destRectangle, out position, out sourceRect))
                {
                    // are we mouse over this image?
                    sourceRect.X = 0;
                    sourceRect.Y = 0;
                    Texture2D texture = null;

                    if (image.RegionIndex == _activeHREF)
                    {
                        if (_activeHREF_usedownhue)
                            texture = image.ImageDown;
                        if (texture == null)
                            texture = image.ImageOver;
                    }

                    if (texture == null)
                        texture = image.Image;

                    sb.Draw2D(texture, position,
                        sourceRect, 0, false, false);
                }
            }
        }
Beispiel #11
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     spriteBatch.Draw2D(_texture, Position, 0, false, false);
     base.Draw(spriteBatch);
 }
Beispiel #12
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            if (!Visible)
                return;
            // don't draw any server gumps until we're in the world.
            if (IsServerGump && !ClientVars.EngineVars.InWorld)
                return;

            if (_renderFullScreen)
            {
                InputMultiplier = (float)spriteBatch.GraphicsDevice.Viewport.Width / (float)Width;

                if (_gumpTexture == null)
                {
                    // the render target CANNOT be larger than the viewport.
                    int w = Width < _manager.Width ? Width : _manager.Width;
                    int h = Height < _manager.Height ? Height : _manager.Height;
                    _gumpTexture = new RenderTarget2D(spriteBatch.GraphicsDevice, w, h, false, SurfaceFormat.Color, DepthFormat.Depth16);
                }

                spriteBatch.GraphicsDevice.SetRenderTarget(_gumpTexture);
                spriteBatch.GraphicsDevice.Clear(Color.Transparent);

                base.Draw(spriteBatch);
                spriteBatch.Flush();

                spriteBatch.GraphicsDevice.SetRenderTarget(null);

                if (_renderFullScreen)
                {
                    spriteBatch.Draw2D(_gumpTexture, new Rectangle(0, 0, (int)(Width * InputMultiplier), (int)(Height * InputMultiplier)), 0, false, false);
                }
                else
                    spriteBatch.Draw2D(_gumpTexture, Position, 0, false, false);
            }
            else
            {
                spriteBatch.Flush();
                base.Draw(spriteBatch);
            }
        }
Beispiel #13
0
        public void Draw(SpriteBatchUI sb, Point2D position)
        {
            Point2D cursorOffset;
            Rectangle sourceRect = Rectangle.Empty;
            int cursorTextureID = 0;
            int cursorHue = 0;
            Texture2D cursorTexture = null;

            if (IsHolding)
            {
                // Draw the item you're holding first.
                cursorOffset = new Point2D(holdingOffset.X, holdingOffset.Y);
                cursorTexture = HoldingTexture;
                sourceRect = new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height);
                sb.Draw2D(cursorTexture, position - cursorOffset, sourceRect, holdingItem.Hue, false, false);
                // then set the data for the hang which holds it.
                cursorOffset = new Point2D(1, 1);
                cursorTextureID = 8305;
                cursorTexture = Data.Art.GetStaticTexture(cursorTextureID);
                sourceRect = new Rectangle(1, 1, cursorTexture.Width - 2, cursorTexture.Height - 2);
            }
            else if (IsTargeting)
            {
                cursorOffset = new Point2D(13, 13);
                sourceRect = new Rectangle(1, 1, 46, 34);
                cursorTextureID = 8310;
                if (_targetingMulti != -1)
                {
                    // !!! Draw a multi
                }
            }
            else
            {
                if (ClientVars.EngineVars.InWorld && (!_manager.IsMouseOverUI && !_manager.IsModalMsgBoxOpen))
                {
                    switch (ClientVars.EngineVars.CursorDirection)
                    {
                        case Direction.North:
                            cursorOffset = new Point2D(29, 1);
                            cursorTextureID = 8299;
                            break;
                        case Direction.Right:
                            cursorOffset = new Point2D(41, 9);
                            cursorTextureID = 8300;
                            break;
                        case Direction.East:
                            cursorOffset = new Point2D(36, 24);
                            cursorTextureID = 8301;
                            break;
                        case Direction.Down:
                            cursorOffset = new Point2D(14, 33);
                            cursorTextureID = 8302;
                            break;
                        case Direction.South:
                            cursorOffset = new Point2D(4, 28);
                            cursorTextureID = 8303;
                            break;
                        case Direction.Left:
                            cursorOffset = new Point2D(2, 10);
                            cursorTextureID = 8304;
                            break;
                        case Direction.West:
                            cursorOffset = new Point2D(1, 1);
                            cursorTextureID = 8305;
                            break;
                        case Direction.Up:
                            cursorOffset = new Point2D(4, 2);
                            cursorTextureID = 8298;
                            break;
                        default:
                            cursorOffset = new Point2D(2, 10);
                            cursorTextureID = 8309;
                            break;
                    }
                }
                else
                {
                    // Over the interface or not in world. Display a default cursor.
                    cursorOffset = new Point2D(1, 1);
                    cursorTextureID = 8305;
                }
            }

            // Hue the cursor if in warmode.
            if (ClientVars.EngineVars.WarMode)
                cursorTextureID -= 23;
            else if (TrammelHue)
                cursorHue = 2412;

            cursorTexture = Data.Art.GetStaticTexture(cursorTextureID);
            sourceRect = new Rectangle(1, 1, cursorTexture.Width - 2, cursorTexture.Height - 2);

            sb.Draw2D(cursorTexture, position - cursorOffset, sourceRect, cursorHue, false, false);
        }
        void drawLargePaperdoll_Noninteractable(SpriteBatchUI spriteBatch)
        {
            EquipSlots[] slotsToDraw = new EquipSlots[6] { EquipSlots.Body, EquipSlots.Footwear, EquipSlots.Legging, EquipSlots.Shirt, EquipSlots.Hair, EquipSlots.FacialHair };
            for (int i = 0; i < slotsToDraw.Length; i++)
            {
                int bodyID = 0, hue = hueSlot(slotsToDraw[i]);
                bool hueGreyPixelsOnly = true;

                switch (slotsToDraw[i])
                {
                    case EquipSlots.Body:
                        if (_isElf)
                            bodyID = (_isFemale ? 1893 : 1894);
                        else
                            bodyID = (_isFemale ? 1888 : 1889);
                        break;
                    case EquipSlots.Footwear:
                        bodyID = (_isFemale ? 1891 : 1890);
                        hue = 900;
                        break;
                    case EquipSlots.Legging:
                        bodyID = (_isFemale ? 1892 : 1848);
                        hue = 348;
                        break;
                    case EquipSlots.Shirt:
                        bodyID = (_isFemale ? 1812 : 1849);
                        hue = 792;
                        break;
                    case EquipSlots.Hair:
                        if (equipmentSlot(EquipSlots.Hair) != 0)
                        {
                            bodyID = _isFemale ?
                                Data.HairStyles.FemaleGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.Hair)) :
                                Data.HairStyles.MaleGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.Hair));
                            hueGreyPixelsOnly = false;
                        }
                        break;
                    case EquipSlots.FacialHair:
                        if (equipmentSlot(EquipSlots.FacialHair) != 0)
                        {
                            bodyID = _isFemale ?
                                0 : Data.HairStyles.FacialHairGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.FacialHair));
                            hueGreyPixelsOnly = false;
                        }
                        break;
                }

                if (bodyID != 0)
                    spriteBatch.Draw2D(Data.Gumps.GetGumpXNA(bodyID), Position, hue, hueGreyPixelsOnly, false);
            }
        }
Beispiel #15
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     base.Draw(spriteBatch);
     // DEBUG !!! Draws a dragon
     // Data.FrameXNA[] f = Data.AnimationsXNA.GetAnimation(59, 0, 0, 0, false);
     // spriteBatch.Draw(f[0].Texture, new Microsoft.Xna.Framework.Vector2(10, 10), 0, false);
 }
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     drawLargePaperdoll_Noninteractable(spriteBatch);
 }
Beispiel #17
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            Texture2D texture = getTextureFromMouseState();

            if (Caption != string.Empty)
                _textRenderer.Text = Caption;

            spriteBatch.Draw2D(texture, new Rectangle(X, Y, Width, Height), 0, false, false);
            if (DoDrawBounds)
                DrawBounds(spriteBatch, Color.Black);

            if (Caption != string.Empty)
            {
                int yoffset = MouseDownOnThis ? 1 : 0;
                _textRenderer.Draw(spriteBatch,
                    new Point2D(X + (Width - _textRenderer.Width) / 2,
                        Y + yoffset + (Height - _textRenderer.Height) / 2));
            }
            base.Draw(spriteBatch);
        }
Beispiel #18
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     spriteBatch.Draw2DTiled(_bgGump, new Rectangle(X, Y, Area.Width, Area.Height), 0, false, false);
     base.Draw(spriteBatch);
 }
Beispiel #19
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     bool hueOnlyGreyPixels = (_hue & 0x8000) == 0x8000;
     spriteBatch.Draw2D(_texture, Position, _hue & 0x7FFF, hueOnlyGreyPixels, false);
     base.Draw(spriteBatch);
 }
Beispiel #20
0
        protected void DrawBounds(SpriteBatchUI spriteBatch, Color color)
        {
            int hue = Data.HuesXNA.GetWebSafeHue(color);

            Rectangle drawArea = _area;
            if (_owner == null)
            {
                _area.X -= X;
                _area.Y -= Y;
            }

            spriteBatch.Draw2D(BoundsTexture, new Rectangle(X, Y, Width, 1), hue, false, false);
            spriteBatch.Draw2D(BoundsTexture, new Rectangle(X, Y + Height - 1, Width, 1), hue, false, false);
            spriteBatch.Draw2D(BoundsTexture, new Rectangle(X, Y, 1, Height), hue, false, false);
            spriteBatch.Draw2D(BoundsTexture, new Rectangle(X + Width - 1, Y, 1, Height), hue, false, false);
        }
Beispiel #21
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     _texture = Data.ASCIIText.GetTextTexture(Text, FontID);
     spriteBatch.Draw2D(_texture, Position, Hue, true, false);
     base.Draw(spriteBatch);
 }
Beispiel #22
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     _textRenderer.Draw(spriteBatch, new Rectangle(X, Y, Size.X, Size.Y), 0, 0);
     base.Draw(spriteBatch);
 }
Beispiel #23
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     _textRenderer.Draw(spriteBatch, Position);
     base.Draw(spriteBatch);
 }
Beispiel #24
0
 public void Draw(SpriteBatchUI sb, Point2D position)
 {
     Draw(sb, new Rectangle(position.X, position.Y, Width, Height), 0, 0);
 }
Beispiel #25
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     base.Draw(spriteBatch);
 }
Beispiel #26
0
        public virtual void Draw(SpriteBatchUI spriteBatch)
        {
            if (!_isInitialized)
                return;
            if (!Visible)
                return;

            #if DEBUG
            // DrawBounds(spriteBatch);
            #endif

            foreach (Control c in Controls)
            {
                if ((c.Page == 0) || (c.Page == ActivePage))
                {
                    if (c.IsInitialized)
                    {
                        c.Position += Position;
                        c.Draw(spriteBatch);
                        c.Position -= Position;
                    }
                }
            }
        }