コード例 #1
0
        public override void Render()
        {
            Debug.Assert(this.pAzulSprite != null);
            Debug.Assert(this.pColor != null);
            Debug.Assert(this.pScreenRect != null);
            Debug.Assert(this.pMessage != null);
            Debug.Assert(this.pMessage.Length > 0);

            float xTmp = this.x;
            float yTmp = this.y;

            float xEnd = this.x;

            for (int i = 0; i < this.pMessage.Length; i++)
            {
                int key = Convert.ToByte(pMessage[i]);

                Glyph pGlyph = GlyphManager.Find(this.glyphName, key);
                Debug.Assert(pGlyph != null);

                xTmp = xEnd + pGlyph.GetAzulSubRect().width / 2;
                this.pScreenRect.Set(xTmp, yTmp, pGlyph.GetAzulSubRect().width, pGlyph.GetAzulSubRect().height);

                pAzulSprite.Swap(pGlyph.GetAzulTexture(), pGlyph.GetAzulSubRect(), this.pScreenRect, this.pColor);

                pAzulSprite.Update();
                pAzulSprite.Render();

                // move the starting to the next character
                xEnd = pGlyph.GetAzulSubRect().width / 2 + xTmp;
            }
        }
コード例 #2
0
        override public void render()
        {
            Debug.Assert(this.azulSprite != null);
            Debug.Assert(this.fontColor != null);
            Debug.Assert(this.screenRect != null);
            Debug.Assert(this.text != null);
            Debug.Assert(this.text.Length > 0);

            float xTmp = this.x;
            float yTmp = this.y;

            float xEnd = this.x;

            for (int i = 0; i < this.text.Length; i++)
            {
                int   key    = Convert.ToByte(text[i]);
                Glyph pGlyph = GlyphManager.Find(this.glyphName, key);
                Debug.Assert(pGlyph != null);
                xTmp = xEnd + pGlyph.glyphRect.width / 2;
                this.screenRect.Set(xTmp, yTmp, pGlyph.glyphRect.width, pGlyph.glyphRect.height);
                azulSprite.Swap(pGlyph.glyphTex.getAzulTexture(), pGlyph.glyphRect, this.screenRect, this.fontColor);
                azulSprite.Update();
                azulSprite.Render();
                xEnd = pGlyph.glyphRect.width / 2 + xTmp;
            }
        }