コード例 #1
0
        public void setRegion(int x, int y, int width, int height)
        {
            var invTexWidth  = 1f / _texture.getWidth();
            var invTexHeight = 1f / _texture.getHeight();

            setRegion(x * invTexWidth, y * invTexHeight, (x + width) * invTexWidth, (y + height) * invTexHeight);
            _regionWidth  = Math.Abs(width);
            _regionHeight = Math.Abs(height);
        }
コード例 #2
0
        public void drawTexture(Texture texture, float x, float y, float width, float height, bool flipY)
        {
            beginRendering();
            if (texture.getUAddressMode() != _currentUMode || texture.getVAddressMode() != _currentVMode)
            {
                _currentUMode = texture.getUAddressMode();
                _currentVMode = texture.getVAddressMode();
                updateAddressMode();
            }

            _sharedPositionVector.X = x;
            _sharedPositionVector.Y = y;
            _sharedScaleVector.X    = width / texture.getWidth();
            _sharedScaleVector.Y    = height / texture.getHeight();
            _spriteBatch.Draw(((MonoGameTexture)texture).texture2D, _sharedPositionVector, null, _tint, 0,
                              Vector2.Zero, _sharedScaleVector, flipY ? SpriteEffects.FlipVertically : SpriteEffects.None, 0f);
        }
コード例 #3
0
 public void setRegion(Texture texture)
 {
     _texture = texture;
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
コード例 #4
0
 public MonoGameTextureRegion(Texture texture)
 {
     _texture = texture ?? throw new java.lang.IllegalArgumentException();
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
コード例 #5
0
ファイル: MonoGameGraphics.cs プロジェクト: mildmelon/mini2Dx
 public void drawTexture(Texture texture, float x, float y, float width, float height, bool flipY)
 {
     if (texture.getUAddressMode() != _currentUMode || texture.getVAddressMode() != _currentVMode)
     {
         _currentUMode = texture.getUAddressMode();
         _currentVMode = texture.getVAddressMode();
         updateAddressMode();
     }
     _spriteBatch.Draw(((MonoGameTexture)texture).texture2D, (new Vector2(x, y) + _translation - _rotationCenter) * _scale, null, _tint, 0,
                       Vector2.Zero, new Vector2(width / texture.getWidth(), height / texture.getHeight()) * _scale,
                       flipY ? SpriteEffects.FlipVertically : SpriteEffects.None, 0f);
 }
コード例 #6
0
ファイル: MonoGameGraphics.cs プロジェクト: mildmelon/mini2Dx
 public void drawTexture(Texture texture, float x, float y, bool flipY)
 {
     drawTexture(texture, x, y, texture.getWidth(), texture.getHeight(), flipY);
 }
コード例 #7
0
ファイル: MonoGameSprite.cs プロジェクト: binlee1990/mini2Dx
 public MonoGameSprite(Texture texture) : this(texture, texture.getWidth(), texture.getHeight())
 {
 }
コード例 #8
0
 public void drawTexture(Texture texture, float x, float y, float width, float height, bool flipY)
 {
     _spriteBatch.Draw(((MonoGameTexture)texture).texture2D, (new Vector2(x, y) + _translation - _rotationCenter) * _scale, null, _tint, 0,
                       Vector2.Zero, new Vector2(width / texture.getWidth(), height / texture.getHeight()) * _scale,
                       flipY ? SpriteEffects.FlipVertically : SpriteEffects.None, 0f);
 }