RenderAtlasedTextureToScreen() public method

Used for rendering directly to screen with an atlased texture.
public RenderAtlasedTextureToScreen ( List lines, HorizontalAlignment horizontalAlignment, float textureToRenderHeight, Color color, float rotation, float fontScale, SystemManagers managers, SpriteRenderer spriteRenderer, object objectRequestingChange ) : void
lines List
horizontalAlignment HorizontalAlignment
textureToRenderHeight float
color Color
rotation float
fontScale float
managers SystemManagers
spriteRenderer SpriteRenderer
objectRequestingChange object
return void
Example #1
0
        private void RenderUsingBitmapFont(SpriteRenderer spriteRenderer, SystemManagers managers)
        {
            if (mTempForRendering == null)
            {
                mTempForRendering = new LineRectangle(managers);
            }

            mTempForRendering.X      = this.X;
            mTempForRendering.Y      = this.Y;
            mTempForRendering.Width  = this.mTextureToRender.Width * mFontScale;
            mTempForRendering.Height = this.mTextureToRender.Height * mFontScale;

            //mTempForRendering.Parent = this.Parent;

            float widthDifference = this.EffectiveWidth - mTempForRendering.Width;

            if (this.HorizontalAlignment == Graphics.HorizontalAlignment.Center)
            {
                mTempForRendering.X += widthDifference / 2.0f;
            }
            else if (this.HorizontalAlignment == Graphics.HorizontalAlignment.Right)
            {
                mTempForRendering.X += widthDifference;
            }

            if (this.VerticalAlignment == Graphics.VerticalAlignment.Center)
            {
                mTempForRendering.Y += (this.EffectiveHeight - mTempForRendering.Height) / 2.0f;
            }
            else if (this.VerticalAlignment == Graphics.VerticalAlignment.Bottom)
            {
                mTempForRendering.Y += this.EffectiveHeight - mTempForRendering.Height;
            }

            if (this.Parent != null)
            {
                mTempForRendering.X += Parent.GetAbsoluteX();
                mTempForRendering.Y += Parent.GetAbsoluteY();
            }

            if (mBitmapFont?.AtlasedTexture != null)
            {
                mBitmapFont.RenderAtlasedTextureToScreen(mWrappedText, this.HorizontalAlignment, mTextureToRender.Height,
                                                         new Color(mRed, mGreen, mBlue, mAlpha), Rotation, mFontScale, managers, spriteRenderer, this);
            }
            else
            {
                Sprite.Render(managers, spriteRenderer, mTempForRendering, mTextureToRender,
                              new Color(mRed, mGreen, mBlue, mAlpha), null, false, false, Rotation, treat0AsFullDimensions: false,
                              objectCausingRenering: this);
            }
        }
Example #2
0
        private void RenderUsingBitmapFont(SpriteRenderer spriteRenderer, SystemManagers managers)
        {
            UpdateIpsoForRendering();

            if (mBitmapFont?.AtlasedTexture != null)
            {
                mBitmapFont.RenderAtlasedTextureToScreen(mWrappedText, this.HorizontalAlignment, mTextureToRender.Height,
                                                         new Color(mRed, mGreen, mBlue, mAlpha), Rotation, mFontScale, managers, spriteRenderer, this);
            }
            else
            {
                Sprite.Render(managers, spriteRenderer, mTempForRendering, mTextureToRender,
                              new Color(mRed, mGreen, mBlue, mAlpha), null, false, false, Rotation, treat0AsFullDimensions: false,
                              objectCausingRenering: this);
            }
        }