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; } }
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; } }
public static void DrawString(String pString, float x, float y, ColorName color = ColorName.White) { Azul.Sprite pAzulSprite = new Azul.Sprite(); for (int i = 0; i < pString.Length; i++) { int key = Convert.ToByte(pString[i]); Font pFont = FontManager.Find(FontName.Consolas36pt, key); Debug.Assert(pFont != null); pAzulSprite.Swap(pFont.GetAzulTexture(), pFont.GetAzulRect(), new Azul.Rect(x, y, pFont.GetAzulRect().width, pFont.GetAzulRect().height), ColorFactory.Create(color).pAzulColor); pAzulSprite.Update(); pAzulSprite.Render(); x += pFont.GetAzulRect().width; } }