Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            if (image != null)
            {
                if (sizeMode == SizeMode.Normal)
                {
                    renderer.Draw(image, rect.X, rect.Y, sourceRect, Color);
                }
                else if (sizeMode == SizeMode.Auto)
                {
                    renderer.Draw(image, rect.X, rect.Y, sourceRect, Color);
                }
                else if (sizeMode == SizeMode.Stretched)
                {
                    renderer.Draw(image, rect, sourceRect, Color);
                }
                else if (sizeMode == SizeMode.Centered)
                {
                    int x = (rect.Width / 2) - (image.Width / 2);
                    int y = (rect.Height / 2) - (image.Height / 2);

                    renderer.Draw(image, x, y, sourceRect, Color);
                }
                else if (sizeMode == SizeMode.Tiled)
                {
                    renderer.DrawTileTexture(image, rect, Color);
                }
            }
        }
Ejemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////                          
        ////////////////////////////////////////////////////////////////////////////
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            if (image != null)
              {
            if (sizeMode == SizeMode.Normal)
            {
              renderer.Draw(image, rect.X, rect.Y, sourceRect, Color);
            }
            else if (sizeMode == SizeMode.Auto)
            {
              renderer.Draw(image, rect.X, rect.Y, sourceRect, Color);
            }
            else if (sizeMode == SizeMode.Stretched)
            {
              renderer.Draw(image, rect, sourceRect, Color);
            }
            else if (sizeMode == SizeMode.Centered)
            {
              int x = (rect.Width / 2) - (image.Width / 2);
              int y = (rect.Height / 2) - (image.Height / 2);

              renderer.Draw(image, x, y, sourceRect, Color);
            }
            else if (sizeMode == SizeMode.Tiled)
            {
            renderer.DrawTileTexture(image, rect, Color);
            }
              }
        }