コード例 #1
0
        protected override Texture CreateTexture(Size size, GraphicsLoadContext loadContext)
        {
            return(MappedImageUtility.CreateTexture(loadContext, size, spriteBatch =>
            {
                var requiresFlip = !loadContext.GraphicsDevice.IsUvOriginTopLeft;

                var leftWidth = _left.Coords.Width;
                var rightWidth = _right.Coords.Width;

                var leftRect = new Rectangle(0, 0, leftWidth, size.Height);

                spriteBatch.DrawImage(
                    _left.Texture.Value,
                    _left.Coords,
                    leftRect.ToRectangleF(),
                    ColorRgbaF.White,
                    requiresFlip);

                var middleRect = new Rectangle(leftRect.Right, 0, size.Width - leftWidth - rightWidth, size.Height);
                spriteBatch.DrawImage(
                    _middle.Texture.Value,
                    _middle.Coords,
                    middleRect.ToRectangleF(),
                    ColorRgbaF.White,
                    requiresFlip);

                var rightRect = new Rectangle(middleRect.Right, 0, rightWidth, size.Height);
                spriteBatch.DrawImage(
                    _right.Texture.Value,
                    _right.Coords,
                    rightRect.ToRectangleF(),
                    ColorRgbaF.White,
                    requiresFlip);
            }));
        }
コード例 #2
0
 protected override Texture CreateTexture(Size size, GraphicsLoadContext loadContext)
 {
     return MappedImageUtility.CreateTexture(loadContext, size, spriteBatch =>
     {
         spriteBatch.DrawImage(
             _mappedImage.Texture.Value,
             _mappedImage.Coords,
             new Rectangle(Point2D.Zero, size).ToRectangleF(),
             ColorRgbaF.White);
     });
 }
コード例 #3
0
ファイル: MappedImageSource.cs プロジェクト: wu162/OpenSAGE
        protected override Texture CreateTexture(Size size, GraphicsLoadContext loadContext)
        {
            return(MappedImageUtility.CreateTexture(loadContext, size, spriteBatch =>
            {
                var requiresFlip = !loadContext.GraphicsDevice.IsUvOriginTopLeft;

                spriteBatch.DrawImage(
                    _mappedImage.Texture.Value,
                    _mappedImage.Coords,
                    new Rectangle(Point2D.Zero, size).ToRectangleF(),
                    ColorRgbaF.White,
                    requiresFlip);
            }));
        }
コード例 #4
0
 protected override Texture CreateTexture(Size size, GraphicsLoadContext loadContext)
 {
     return(MappedImageUtility.CreateTexture(loadContext, _mappedImage));
 }