Exemplo n.º 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  = System.Math.Abs(width);
            _regionHeight = System.Math.Abs(height);
        }
Exemplo n.º 2
0
 public MonoGameTextureRegion(Texture texture)
 {
     if (texture == null)
     {
         throw new Java.Lang.IllegalArgumentException();
     }
     _texture = texture;
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public void setRegion(Texture texture)
 {
     _texture = texture;
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
Exemplo n.º 5
0
 public int add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight, float scaleX,
                float scaleY, bool flipX, bool flipY)
 {
     return(add(texture, x, y, 0, 0, texture.getWidth(), texture.getWidth(), 1, 1, 0, 0, 0, false, false));
 }
Exemplo n.º 6
0
 public int add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)
 {
     return(add(texture, x, y, 0, 0, texture.getWidth(), texture.getWidth(), false, false));
 }
Exemplo n.º 7
0
 public int add(Texture texture, float x, float y)
 {
     return(add(texture, x, y, 0, 0, texture.getWidth(), texture.getWidth()));
 }
Exemplo n.º 8
0
 public MonoGameSprite(Texture texture) : this(texture, texture.getWidth(), texture.getHeight())
 {
 }
Exemplo n.º 9
0
 public void drawTexture(Texture texture, float x, float y, bool flipY)
 {
     drawTexture(texture, x, y, texture.getWidth(), texture.getHeight(), flipY);
 }