Пример #1
0
        /// <summary>
        /// Renders the current quad batch and resets it.
        /// </summary>
        public void FinishQuadBatch()
        {
            if (_quadBatchTop.NumQuads != 0)
            {
                _quadBatchTop.Render(_projectionMatrix);
                _quadBatchTop.Reset();

                if (_quadBatchSize == _quadBatchIndex + 1)
                {
                    _quadBatches.Add(new QuadBatch());
                    _quadBatchSize++;
                }

                _numDrawCalls++;
                _quadBatchTop = _quadBatches[++_quadBatchIndex];
            }
        }
Пример #2
0
        private void Redraw()
        {
            if (_requiresRedraw)
            {
                _contents.Reset();
                BitmapFont bitmapFont;
                bitmapFonts.TryGetValue(_fontName, out bitmapFont);
                if (bitmapFont == null)
                {
                    throw new InvalidOperationException("bitmap font " + _fontName + " not registered!");
                }

                bitmapFont.FillQuadBatch(_contents, _hitArea.Width, _hitArea.Height, _text,
                                         _fontSize, _color, _hAlign, _vAlign, _autoScale, _kerning);

                _textBounds     = null; // will be created on demand
                _requiresRedraw = false;
            }
        }