Example #1
0
 public MonoGameTextureRegion(Texture texture)
 {
     if (texture == null)
     {
         throw new Java.Lang.IllegalArgumentException();
     }
     _texture = texture;
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
Example #2
0
 public MonoGameTextureRegion(Texture texture, int x, int y, int width, int height)
 {
     if (texture == null)
     {
         throw new Java.Lang.IllegalArgumentException();
     }
     _texture = texture;
     setRegion(x, y, width, height);
 }
        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);
        }
        public int add(Texture 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)
        {
            var operation = new SpriteCacheDrawingOperation
            {
                srcWidth  = srcWidth,
                srcHeight = srcHeight,
                dstX      = x,
                dstY      = y,
                scaleX    = scaleX,
                scaleY    = scaleY,
                originX   = originX,
                originY   = originY,
                rotation  = rotation,
                flipX     = flipX,
                flipY     = flipY,
                color     = _currentColor
            };

            add(texture, srcX, srcY, srcWidth, srcHeight, out operation.srcX, out operation.srcY);
            _caches[_currentCache].operations.Add(operation);
            return(_caches[_currentCache].operations.Count - 1);
        }
        private void add(Texture texture, int srcX, int srcY, int srcWidth, int srcHeight, out int posX, out int posY)
        {
            if (_posX + srcWidth > _caches[_currentCache].texture.getWidth())
            {
                _posX      = 0;
                _posY     += _maxHeight;
                _maxHeight = 0;
            }

            _sharedSourceRectangle.X      = srcX;
            _sharedSourceRectangle.Y      = srcY;
            _sharedSourceRectangle.Width  = srcWidth;
            _sharedSourceRectangle.Height = srcHeight;
            _sharedPositionVector.X       = _posX;
            _sharedPositionVector.Y       = _posY;
            posX = _posX;
            posY = _posY;

            _spriteBatch.Draw(((MonoGameTexture)texture).texture2D, new Vector2(_posX, _posY),
                              new Rectangle(srcX, srcY, srcWidth, srcHeight), Microsoft.Xna.Framework.Color.White, 0f,
                              Vector2.Zero, Vector2.One, SpriteEffects.None, 0f);
            _posX     += srcWidth;
            _maxHeight = Math.Max(srcHeight, _maxHeight);
        }
Example #6
0
 public void setParameter(Java.Lang.String str, Org.Mini2Dx.Core.Graphics.Texture t)
 {
     setParameter(str, 0, t);
 }
 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));
 }
 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));
 }
Example #9
0
 public MonoGameTextureRegion(Texture texture, int width, int height) : this(texture, 0, 0, width, height)
 {
 }
Example #10
0
 public override TextureAtlasRegion newTextureAtlasRegion(Texture texture, Java.Lang.String name, int index, int x, int y, int width, int height,
                                                          bool rotate, int originalWidth, int originalHeight, int offsetX, int offsetY)
 {
     return(new MonoGameTextureAtlasRegion(texture, name, index, x, y, width, height, rotate, originalWidth, originalHeight, offsetX, offsetY));
 }
Example #11
0
 public void setRegion(TextureRegion region, int x, int y, int width, int height)
 {
     _texture = region.getTexture();
     setRegion(region.getRegionX() + x, region.getRegionY() + y, width, height);
 }
Example #12
0
 public override Sprite newSprite(Texture texture)
 {
     return(new MonoGameSprite(texture));
 }
Example #13
0
 public void drawTexture(Texture texture, float x, float y, float width, float height)
 {
     drawTexture(texture, x, y, width, height, false);
 }
Example #14
0
        public void setParameter(Java.Lang.String str, int i, Org.Mini2Dx.Core.Graphics.Texture t)
        {
            MonoGameTexture texture = t as MonoGameTexture;

            shader.Parameters[(string)str].SetValue(texture.texture2D);
        }
Example #15
0
 public void drawTexture(Texture texture, float x, float y, bool flipY)
 {
     drawTexture(texture, x, y, texture.getWidth(), texture.getHeight(), flipY);
 }
Example #16
0
 public void drawTexture(Texture texture, float x, float y)
 {
     drawTexture(texture, x, y, false);
 }
Example #17
0
 public override TextureRegion newTextureRegion(Texture texture, int x, int y, int width, int height)
 {
     return(new MonoGameTextureRegion(texture, x, y, width, height));
 }
Example #18
0
 public override TextureRegion newTextureRegion(Texture texture)
 {
     return(new MonoGameTextureRegion(texture));
 }
Example #19
0
 public override Sprite newSprite(Texture texture, int x, int y, int width, int height)
 {
     return(new MonoGameSprite(texture, x, y, width, height));
 }
Example #20
0
 public void setRegion(TextureRegion region)
 {
     _texture = region.getTexture();
     setRegion(region.getU(), region.getV(), region.getU2(), region.getV2());
 }
Example #21
0
 public MonoGameSprite(Texture texture) : this(texture, texture.getWidth(), texture.getHeight())
 {
 }
Example #22
0
 public virtual void setTexture(Texture texture)
 {
     _texture = texture;
 }
Example #23
0
 public MonoGameSprite(Texture texture, int srcWidth, int srcHeight) : this(texture, 0, 0, srcWidth, srcHeight)
 {
 }
Example #24
0
 public MonoGameSprite(Texture texture, int srcX, int srcY, int srcWidth, int srcHeight) : base(texture, srcX,
                                                                                                srcY, srcWidth, srcHeight)
 {
     setBounds(srcX, srcY, srcWidth, srcHeight);
     setOriginCenter();
 }
 public int add(Texture texture, float x, float y)
 {
     return(add(texture, x, y, 0, 0, texture.getWidth(), texture.getWidth()));
 }
Example #26
0
 public void setRegion(Texture texture)
 {
     _texture = texture;
     setRegion(0, 0, texture.getWidth(), texture.getHeight());
 }
Example #27
0
 public override NinePatch newNinePatch(Texture texture, int left, int right, int top, int bottom)
 {
     return(newNinePatch(new MonoGameTextureRegion(texture), left, right, top, bottom));
 }