Ejemplo n.º 1
0
        public override void Draw(GameTime gameTime, SpriteBatch batch)
        {
            base.Draw(gameTime, batch);
#if DEBUG
            Texture2D fill = Engine.TextureManager.GetFillTexture();

            Rectangle rect;
            rect.X      = (int)_sprite.Transform.X;
            rect.Y      = (int)_sprite.Transform.Y;
            rect.Width  = (int)_sprite.SizeX;
            rect.Height = 1;
            batch.Draw(fill, rect, DebugColor.CurrentColor);

            rect.X      = (int)_sprite.Transform.X;
            rect.Y      = (int)(_sprite.Transform.Y + _sprite.SizeY - 1);
            rect.Width  = (int)_sprite.SizeX;
            rect.Height = 1;
            batch.Draw(fill, rect, DebugColor.CurrentColor);

            rect.X      = (int)_sprite.Transform.X;
            rect.Y      = (int)_sprite.Transform.Y;
            rect.Width  = 1;
            rect.Height = (int)_sprite.SizeY;
            batch.Draw(fill, rect, DebugColor.CurrentColor);

            rect.X      = (int)(_sprite.Transform.X + _sprite.SizeX);
            rect.Y      = (int)_sprite.Transform.Y;
            rect.Width  = 1;
            rect.Height = (int)_sprite.SizeY;
            batch.Draw(fill, rect, DebugColor.CurrentColor);

            _debugTransformText.Text        = "x : " + Math.Floor(_sprite.Transform.X) + " y : " + Math.Floor(_sprite.Transform.Y);
            _debugTransformText.Transform.X = _sprite.Transform.X;
            _debugTransformText.Transform.Y = _sprite.Transform.Y - _debugTransformText.Font.LineSpacing;

            _debugTransformText.Draw(gameTime, batch);
#endif
        }
Ejemplo n.º 2
0
        public override void Draw(GameTime gameTime, SpriteBatch batch)
        {
            base.Draw(gameTime, batch);
            Rectangle destinationRect = BoundingBox;

            if (FillTexture != null)
            {
                if (IsMouseHovering)
                {
                    //TODO Make this not hideous
                    batch.Draw(FillTexture, BoundingBox, Color.Gray);
                }
                else
                {
                    batch.Draw(FillTexture, BoundingBox, Color.White);
                }
            }
            else
            {
                Color fillColor = IsMouseHovering ? HoverFillColor.CurrentColor : FillColor.CurrentColor;
                batch.Draw(_drawTexture, BoundingBox, fillColor);
            }

            if (IsMouseHovering && DrawMouseHoverHighlightBorder)
            {
                destinationRect.X      = (int)Transform.X;
                destinationRect.Y      = (int)Transform.Y;
                destinationRect.Width  = BoundingBox.Width;
                destinationRect.Height = BorderSize;
                batch.Draw(_drawTexture, destinationRect, HoverBorderFillColor.CurrentColor);

                destinationRect.X      = (int)Transform.X;
                destinationRect.Y      = (int)Transform.Y + BoundingBox.Height - BorderSize;
                destinationRect.Width  = BoundingBox.Width;
                destinationRect.Height = BorderSize;
                batch.Draw(_drawTexture, destinationRect, HoverBorderFillColor.CurrentColor);

                destinationRect.X      = (int)Transform.X;
                destinationRect.Y      = (int)Transform.Y;
                destinationRect.Width  = BorderSize;
                destinationRect.Height = BoundingBox.Height;
                batch.Draw(_drawTexture, destinationRect, HoverBorderFillColor.CurrentColor);

                destinationRect.X      = (int)Transform.X + BoundingBox.Width - BorderSize;
                destinationRect.Y      = (int)Transform.Y;
                destinationRect.Width  = BorderSize;
                destinationRect.Height = BoundingBox.Height;
                batch.Draw(_drawTexture, destinationRect, HoverBorderFillColor.CurrentColor);
            }
            else if (DrawBorder)
            {
                destinationRect.X      = (int)Transform.X;
                destinationRect.Y      = (int)Transform.Y;
                destinationRect.Width  = BoundingBox.Width;
                destinationRect.Height = BorderSize;
                batch.Draw(_drawTexture, destinationRect, OutlineColor.CurrentColor);

                destinationRect.X      = (int)Transform.X;
                destinationRect.Y      = (int)Transform.Y + BoundingBox.Height - BorderSize;
                destinationRect.Width  = BoundingBox.Width;
                destinationRect.Height = BorderSize;
                batch.Draw(_drawTexture, destinationRect, OutlineColor.CurrentColor);

                destinationRect.X      = (int)Transform.X;
                destinationRect.Y      = (int)Transform.Y;
                destinationRect.Width  = BorderSize;
                destinationRect.Height = BoundingBox.Height;
                batch.Draw(_drawTexture, destinationRect, OutlineColor.CurrentColor);

                destinationRect.X      = (int)Transform.X + BoundingBox.Width - BorderSize;
                destinationRect.Y      = (int)Transform.Y;
                destinationRect.Width  = BorderSize;
                destinationRect.Height = BoundingBox.Height;
                batch.Draw(_drawTexture, destinationRect, OutlineColor.CurrentColor);
            }

            _buttonTextControl.Draw(gameTime, batch);
        }