Ejemplo 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);
        }
Ejemplo n.º 2
0
 public MonoGameTextureRegion(Texture texture)
 {
     if (texture == null)
     {
         throw new Java.Lang.IllegalArgumentException();
     }
     _texture = texture;
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
Ejemplo 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);
        }
Ejemplo n.º 4
0
 public void setRegion(Texture texture)
 {
     _texture = texture;
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
Ejemplo n.º 5
0
 public MonoGameSprite(Texture texture) : this(texture, texture.getWidth(), texture.getHeight())
 {
 }
Ejemplo n.º 6
0
 public void drawTexture(Texture texture, float x, float y, bool flipY)
 {
     drawTexture(texture, x, y, texture.getWidth(), texture.getHeight(), flipY);
 }