예제 #1
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (m_texture == null)
         m_texture = ASCIIText.GetTextTexture(Text, FontID, Area.Width);
     spriteBatch.Draw2D(m_texture, Position, Hue, true, false);
     base.Draw(spriteBatch);
 }
예제 #2
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (m_texture == null)
     {
         m_texture = UltimaData.ArtData.GetStaticTexture(m_item.DisplayItemID);
         Size = new Point(m_texture.Width, m_texture.Height);
     }
     spriteBatch.Draw2D(m_texture, Position, m_item.Hue, false, false);
     base.Draw(spriteBatch);
 }
예제 #3
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            int centerWidth = Width - m_bgGumps[0].Width - m_bgGumps[2].Width;
            int centerHeight = Height - m_bgGumps[0].Height - m_bgGumps[2].Height;
            int line2Y = Y + m_bgGumps[0].Height;
            int line3Y = Y + Height - m_bgGumps[6].Height;

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

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

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

            base.Draw(spriteBatch);
        }
예제 #4
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (m_texture == null)
     {
         if (IsFemale)
             m_texture = UltimaData.GumpData.GetGumpXNA(Item.ItemData.AnimID + 60000);
         if (m_texture == null)
             m_texture = UltimaData.GumpData.GetGumpXNA(Item.ItemData.AnimID + 50000);
         Size = new Point(m_texture.Width, m_texture.Height);
     }
     spriteBatch.Draw2D(m_texture, Position, Item.Hue & 0x7FFF, (Item.Hue & 0x8000) == 0x8000 ? true : false, false);
     base.Draw(spriteBatch);
 }
예제 #5
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            if (m_Texture == null)
            {
                m_Texture = new Texture2D(spriteBatch.GraphicsDevice, Width, Height);
                if (m_TextureData == null)
                    m_Texture.GetData<Color>(m_TextureData);
                else
                    m_Texture.SetData<Color>(m_TextureData);
            }

            spriteBatch.Draw2D(m_Texture, new Rectangle(X, Y, Width, Height), 0, false, false);

            base.Draw(spriteBatch);
        }
예제 #6
0
 public void Draw(SpriteBatchUI sb, Point position)
 {
     Point p = new Point(position.X - m_Offset.X, position.Y - m_Offset.Y);
     sb.Draw2D(m_Texture, p, m_SourceRect, m_Hue, false, false);
 }
예제 #7
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     bool hueOnlyGreyPixels = (m_hue & 0x8000) == 0x8000;
     spriteBatch.Draw2D(m_texture, Position, m_hue & 0x7FFF, hueOnlyGreyPixels, false);
     base.Draw(spriteBatch);
 }
예제 #8
0
파일: Gump.cs 프로젝트: FreeReign/UltimaXNA
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            if (!Visible)
                return;

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

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

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

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

                spriteBatch.GraphicsDevice.SetRenderTarget(null);

                if (m_renderFullScreen)
                {
                    spriteBatch.Draw2D(m_gumpTexture, new Rectangle(0, 0, (int)(Width * InputMultiplier), (int)(Height * InputMultiplier)), 0, false, false);
                }
                else
                    spriteBatch.Draw2D(m_gumpTexture, Position, 0, false, false);
            }
            else
            {
                spriteBatch.Flush();
                base.Draw(spriteBatch);
            }
        }
예제 #9
0
        public void Draw(SpriteBatchUI sb, Rectangle destRectangle, int xScroll, int yScroll)
        {
            checkRender(sb.GraphicsDevice);

            Rectangle sourceRectangle;

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

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

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

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

            sb.Draw2D(m_texture, destRectangle, sourceRectangle, hueButNotIfHTML, false, m_hueTransparent);

            foreach (HTMLRegion r in m_href.Regions)
            {
                Point position;
                Rectangle sourceRect;
                if (clipRectangle(new Point(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 == m_activeHREF)
                            if (m_activeHREF_usedownhue)
                                hue = r.HREFAttributes.DownHue;
                            else
                                hue = r.HREFAttributes.OverHue;
                        else
                            hue = r.HREFAttributes.UpHue;

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

            foreach (HTMLImage image in m_images.Images)
            {
                Point position;
                Rectangle sourceRect;
                if (clipRectangle(new Point(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 == m_activeHREF)
                    {
                        if (m_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);
                }
            }
        }
예제 #10
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     spriteBatch.Draw2D(m_texture, Position, 0, false, false);
     base.Draw(spriteBatch);
 }
예제 #11
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            Texture2D texture = getTextureFromMouseState();

            if (Caption != string.Empty)
                m_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;
                m_textRenderer.Draw(spriteBatch,
                    new Point(X + (Width - m_textRenderer.Width) / 2,
                        Y + yoffset + (Height - m_textRenderer.Height) / 2));
            }
            base.Draw(spriteBatch);
        }
예제 #12
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            if (m_background)
            {
                if (m_backgroundTexture == null)
                {
                    m_backgroundTexture = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
                    m_backgroundTexture.SetData<Color>(new Color[] { Color.White });
                }
                spriteBatch.Draw2D(m_backgroundTexture, new Rectangle(OwnerX + Area.X, OwnerY + Area.Y, Width, Height), 0, false, false);
            }

            m_textRenderer.ActiveHREF = m_hrefOver;
            m_textRenderer.ActiveHREF_UseDownHue = m_clicked;
            m_textRenderer.Draw(spriteBatch, new Rectangle(X, Y, Size.X, Size.Y), ScrollX, ScrollY);

            base.Draw(spriteBatch);
        }
예제 #13
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     // up button
     spriteBatch.Draw2D(m_btnUpClicked ? m_gumpUpButton[1] : m_gumpUpButton[0], new Point(X, Y), 0, false, false);
     // scrollbar background
     spriteBatch.Draw2D(m_gumpBackground[0], new Point(X, Y + m_gumpUpButton[0].Height), 0, false, false);
     int middlewidth = BarHeight - m_gumpUpButton[0].Height - m_gumpDownButton[0].Height - m_gumpBackground[0].Height - m_gumpBackground[2].Height;
     spriteBatch.Draw2DTiled(m_gumpBackground[1], new Rectangle(X, Y + m_gumpUpButton[0].Height + m_gumpBackground[0].Height, m_gumpBackground[0].Width, middlewidth), 0, false, false);
     spriteBatch.Draw2D(m_gumpBackground[2], new Point(X, Y + BarHeight - m_gumpDownButton[0].Height - m_gumpBackground[2].Height), 0, false, false);
     // down button
     spriteBatch.Draw2D(m_btnDownClicked ? m_gumpDownButton[1] : m_gumpDownButton[0], new Point(X, Y + Height - m_gumpDownButton[0].Height), 0, false, false);
     // slider
     spriteBatch.Draw2D(m_gumpSlider, new Point(X + (m_gumpBackground[0].Width - m_gumpSlider.Width) / 2, Y + m_gumpUpButton[0].Height + 1 + (int)m_sliderY), 0, false, false);
     base.Draw(spriteBatch);
 }
예제 #14
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (m_isAnOpenSwatch)
     {
         spriteBatch.Draw2D(m_huesTexture, Area, 0, false, false);
         spriteBatch.Draw2D(m_selectedIndicator, new Point(
             (int)(X + (float)(Width / m_hueSize.X) * ((Index % m_hueSize.X) + 0.5f) - m_selectedIndicator.Width / 2),
             (int)(Y + (float)(Height / m_hueSize.Y) * ((Index / m_hueSize.X) + 0.5f) - m_selectedIndicator.Height / 2)
             ), 0, false, false);
     }
     else
     {
         if (!m_isSwatchOpen)
             spriteBatch.Draw2D(m_huesTexture, Area, 0, false, false);
     }
     base.Draw(spriteBatch);
 }
        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 (m_isElf)
                            bodyID = (m_isFemale ? 1893 : 1894);
                        else
                            bodyID = (m_isFemale ? 1888 : 1889);
                        break;
                    case EquipSlots.Footwear:
                        bodyID = (m_isFemale ? 1891 : 1890);
                        hue = 900;
                        break;
                    case EquipSlots.Legging:
                        bodyID = (m_isFemale ? 1892 : 1848);
                        hue = 348;
                        break;
                    case EquipSlots.Shirt:
                        bodyID = (m_isFemale ? 1812 : 1849);
                        hue = 792;
                        break;
                    case EquipSlots.Hair:
                        if (equipmentSlot(EquipSlots.Hair) != 0)
                        {
                            bodyID = m_isFemale ?
                                UltimaData.HairStyles.FemaleGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.Hair)) :
                                UltimaData.HairStyles.MaleGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.Hair));
                            hueGreyPixelsOnly = false;
                        }
                        break;
                    case EquipSlots.FacialHair:
                        if (equipmentSlot(EquipSlots.FacialHair) != 0)
                        {
                            bodyID = m_isFemale ?
                                0 : UltimaData.HairStyles.FacialHairGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.FacialHair));
                            hueGreyPixelsOnly = false;
                        }
                        break;
                }

                if (bodyID != 0)
                    spriteBatch.Draw2D(UltimaData.GumpData.GetGumpXNA(bodyID), Position, hue, hueGreyPixelsOnly, false);
            }
        }
예제 #16
0
        public override void Draw(SpriteBatchUI spriteBatch)
        {
            if (m_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;
                        }
                    }
                }
                m_renderedTexture = new Texture2D(spriteBatch.GraphicsDevice, Width, Height);
                m_renderedTexture.SetData<Color>(data);
            }

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

            base.Draw(spriteBatch);
        }