Exemplo n.º 1
0
        internal void drawTexture(MonoGameTexture texture, float x, float y, int srcX, int srcY, int srcWidth,
                                  int srcHeight, float scaleX, float scaleY, float originX, float originY, float rotation, bool flipX,
                                  bool flipY, MonoGameColor tint)
        {
            beginRendering();
            if (texture.getUAddressMode() != _currentUMode || texture.getVAddressMode() != _currentVMode)
            {
                _currentUMode = texture.getUAddressMode();
                _currentVMode = texture.getVAddressMode();
                updateAddressMode();
            }


            _sharedPositionVector.X       = x - originX;
            _sharedPositionVector.Y       = y - originY;
            _sharedSourceRectangle.X      = srcX;
            _sharedSourceRectangle.Y      = srcY;
            _sharedSourceRectangle.Width  = srcWidth;
            _sharedSourceRectangle.Height = srcHeight;
            _sharedOriginVector.X         = originX;
            _sharedOriginVector.Y         = originY;
            _sharedScaleVector.X          = scaleX;
            _sharedScaleVector.Y          = scaleY;

            _spriteBatch.Draw(texture.texture2D, _sharedPositionVector, _sharedSourceRectangle, tint._color,
                              MonoGameMathsUtil.degreeToRadian(rotation), _sharedOriginVector, _sharedScaleVector,
                              (flipX ? SpriteEffects.FlipHorizontally : SpriteEffects.None) |
                              (flipY ? SpriteEffects.FlipVertically : SpriteEffects.None), 0f);
        }