예제 #1
0
 public void Draw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics)
 {
     if (Visible)
     {
         spriteBatch.GraphicsDevice.ScissorRectangle = scissorRectangle;
         HandleDraw(spriteBatch, scissorRectangle, drawSpecifics);
     }
 }
예제 #2
0
        protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics)
        {
            Vector4 color = TextColor.ToVector4();

            spriteBatch.DrawString(font, text, Location, new Color(color.X * drawSpecifics.Opacity, color.Y * drawSpecifics.Opacity, color.Z * drawSpecifics.Opacity, color.W * drawSpecifics.Opacity), 0, Vector2.Zero, fontScale, SpriteEffects.None, 0);
        }
예제 #3
0
 protected abstract void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics);
예제 #4
0
        protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics)
        {
            Color drawColor = new Color(drawSpecifics.Opacity, drawSpecifics.Opacity, drawSpecifics.Opacity, drawSpecifics.Opacity);

            int selectionOffset = 0;

            if (hovered)
            {
                selectionOffset += 3;
            }
            spriteBatch.Draw(modularTextures[selectionOffset], new Rectangle(elementRectangle.Location.X, elementRectangle.Location.Y, tileSize, tileSize), drawColor);
            for (int i = 1; i < tileCount - 1; i++)
            {
                spriteBatch.Draw(modularTextures[selectionOffset + 1], new Rectangle(elementRectangle.Location.X + tileSize * i, elementRectangle.Location.Y, tileSize, tileSize), drawColor);
            }
            spriteBatch.Draw(modularTextures[selectionOffset + 2], new Rectangle(elementRectangle.Right - tileSize, elementRectangle.Location.Y, tileSize, tileSize), drawColor);

            textLabel.Draw(spriteBatch, scissorRectangle, drawSpecifics);
        }
예제 #5
0
        protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics)
        {
            Rectangle containedScissorRectangle = Rectangle.Intersect(scissorRectangle, elementRectangle);

            lock (elementLock)
            {
                for (int i = 0; i < containedElements.Count; i++)
                {
                    containedElements[i].Draw(spriteBatch, containedScissorRectangle, drawSpecifics);
                }
            }
        }