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 void Set(Font.Name name, String pMessage, Glyph.Name glyphName, float xStart, float yStart) { Debug.Assert(pMessage != null); this.pMessage = pMessage; this.x = xStart; this.y = yStart; this.name = name; // TODO: for wash... this should be a nullGlyph this.glyphName = glyphName; // Force color to white Debug.Assert(this.pColor != null); this.pColor.Set(1.0f, 1.0f, 1.0f); float totalWidth = 0.0f; float maxHeight = 0.0f; for (int i = 0; i < this.pMessage.Length; i++) { int key = Convert.ToByte(pMessage[i]); Glyph pGlyph = GlyphMan.Find(this.glyphName, key); Debug.Assert(pGlyph != null); totalWidth += pGlyph.GetAzulSubRect().width; if (pGlyph.GetAzulSubRect().height > maxHeight) { maxHeight = pGlyph.GetAzulSubRect().height; } } this.pColRect.Set(new Azul.Rect(this.x + totalWidth / 2, this.y, totalWidth, maxHeight)); }