Пример #1
0
 public void draw(Org.Mini2Dx.Core._Graphics g, int cacheID, int offset, int length)
 {
     for (var i = offset; i < _caches[cacheID].operations.Count && i < offset + length; i++)
     {
         draw(g, _caches[cacheID].texture, _caches[cacheID].operations[i]);
     }
 }
Пример #2
0
        public void draw(Org.Mini2Dx.Core._Graphics g, MonoGameGameFontCache fontCache, Vector2 position)
        {
            int cacheId = fontCache.cacheId;

            if (fontCache._previousDrawingOperations.Count == 0)
            {
                return;
            }
            if (!_caches.ContainsKey(cacheId) || _caches[cacheId] == null)
            {
                setText(fontCache);
            }

            MonoGameTextureRegion textureRegion = _caches[cacheId];

            g.drawTextureRegion(textureRegion, position.X, position.Y);
        }
Пример #3
0
        public void render(Org.Mini2Dx.Core._Graphics g, float x, float y, float width, float height)
        {
            var newTint      = _setColor.copy().multiply(g.getTint());
            var oldTint      = g.getTint();
            var middleWidth  = (int)(width - _leftWidth - _rightWidth);
            var middleHeight = (int)(height - _topHeight - _bottomHeight);

            g.setTint(newTint);

            _ninePatchRegion.setRegionX(_textureRegionX);
            _ninePatchRegion.setRegionY(_textureRegionY);
            _ninePatchRegion.setRegionWidth((int)_leftWidth);
            _ninePatchRegion.setRegionHeight((int)_topHeight);
            draw(g, _ninePatchRegion, x, y, _leftWidth, _topHeight);
            _ninePatchRegion.setRegionX(_textureRegionX + (int)_leftWidth);
            _ninePatchRegion.setRegionWidth((int)_middleWidth);
            draw(g, _ninePatchRegion, x + _leftWidth, y, middleWidth, _topHeight);
            _ninePatchRegion.setRegionX(_textureRegionX + (int)_rightX);
            _ninePatchRegion.setRegionWidth((int)_rightWidth);
            draw(g, _ninePatchRegion, x + width - _rightWidth, y, _rightWidth, _topHeight);
            _ninePatchRegion.setRegionY(_textureRegionY + (int)_topHeight);
            _ninePatchRegion.setRegionHeight((int)_middleHeight);
            draw(g, _ninePatchRegion, x + width - _rightWidth, y + _topHeight, _rightWidth, middleHeight);
            _ninePatchRegion.setRegionX(_textureRegionX + (int)_leftWidth);
            _ninePatchRegion.setRegionWidth((int)_middleWidth);
            draw(g, _ninePatchRegion, x + _leftWidth, y + _topHeight, middleWidth, middleHeight);
            _ninePatchRegion.setRegionX(_textureRegionX);
            _ninePatchRegion.setRegionWidth((int)_leftWidth);
            draw(g, _ninePatchRegion, x, y + _topHeight, _leftWidth, middleHeight);
            _ninePatchRegion.setRegionY(_textureRegionY + (int)_bottomY);
            _ninePatchRegion.setRegionHeight((int)_bottomHeight);
            draw(g, _ninePatchRegion, x, y + height - _bottomHeight, _leftWidth, _bottomHeight);
            _ninePatchRegion.setRegionX(_textureRegionX + (int)_leftWidth);
            _ninePatchRegion.setRegionWidth((int)_middleWidth);
            draw(g, _ninePatchRegion, x + _leftWidth, y + height - _bottomHeight, middleWidth, _bottomHeight);
            _ninePatchRegion.setRegionX(_textureRegionX + (int)_rightX);
            _ninePatchRegion.setRegionWidth((int)_rightWidth);
            draw(g, _ninePatchRegion, x + width - _rightWidth, y + height - _bottomHeight, _rightWidth, _bottomHeight);
            g.setTint(oldTint);
        }
Пример #4
0
 private static void draw(Org.Mini2Dx.Core._Graphics g, TextureRegion ninePatchRegion, float dstX, float dstY, float dstWidth, float dstHeight)
 {
     g.drawTextureRegion(ninePatchRegion, dstX, dstY, dstWidth, dstHeight);
 }
Пример #5
0
 private static void draw(Org.Mini2Dx.Core._Graphics g, MonoGameTexture texture, SpriteCacheDrawingOperation op)
 {
     ((MonoGameGraphics)g).drawTexture(texture, op.dstX, op.dstY, op.srcX, op.srcY, op.srcWidth, op.srcHeight, op.scaleX, op.scaleY, op.originX, op.originY, op.rotation, op.flipX, op.flipY, op.color);
 }
Пример #6
0
 public void draw(Org.Mini2Dx.Core._Graphics g, int cacheID)
 {
     draw(g, cacheID, 0, _caches[cacheID].operations.Count);
 }
 public void draw(Org.Mini2Dx.Core._Graphics g)
 {
     GLOBAL_CACHE.draw(g, this, _position);
 }