Пример #1
0
        private void RenderCharacterByCharacter(SpriteRenderer spriteRenderer)
        {
            BitmapFont fontToUse = mBitmapFont;

            if (mBitmapFont == null)
            {
                fontToUse = LoaderManager.Self.DefaultBitmapFont;
            }


            if (fontToUse != null)
            {
                widths.Clear();
                int requiredWidth;
                int requiredHeight;
                fontToUse.GetRequiredWidthAndHeight(WrappedText, out requiredWidth, out requiredHeight, widths);

                UpdateIpsoForRendering();

                fontToUse.DrawTextLines(WrappedText, HorizontalAlignment, this,
                                        requiredWidth, widths, spriteRenderer, Color,
                                        mTempForRendering.GetAbsoluteLeft(),
                                        mTempForRendering.GetAbsoluteTop(),
                                        this.GetAbsoluteRotation(), FontScale, FontScale);
            }
        }
Пример #2
0
        public void UpdatePreRenderDimensions()
        {
            if (this.mBitmapFont != null)
            {
                int requiredWidth  = 0;
                int requiredHeight = 0;

                if (this.mRawText != null)
                {
                    mBitmapFont.GetRequiredWidthAndHeight(this.WrappedText, out requiredWidth, out requiredHeight);
                }

                mPreRenderWidth  = (int)(requiredWidth + .5f);
                mPreRenderHeight = (int)(requiredHeight + .5f);
            }
        }
Пример #3
0
        private void RenderCharacterByCharacter(SpriteRenderer spriteRenderer)
        {
            BitmapFont fontToUse = mBitmapFont;

            if (mBitmapFont == null)
            {
                fontToUse = LoaderManager.Self.DefaultBitmapFont;
            }


            if (fontToUse != null)
            {
                // todo: reduce allocs by using a static here (static is prob okay since it can't be multithreaded)
                List <int> widths = new List <int>();
                int        requiredWidth;
                int        requiredHeight;
                fontToUse.GetRequiredWidthAndHeight(WrappedText, out requiredWidth, out requiredHeight, widths);

                UpdateIpsoForRendering();

                fontToUse.DrawTextLines(WrappedText, HorizontalAlignment, this,
                                        requiredWidth, widths, spriteRenderer, Color, mTempForRendering.GetAbsoluteLeft(), mTempForRendering.GetAbsoluteTop(), Rotation, FontScale, FontScale);
            }
        }