public override void RenderText(Font font, Point pos, string text) { //m_Target.SaveGLStates(); pos = Translate(pos); global::SFML.Graphics.Font sfFont = font.RendererData as global::SFML.Graphics.Font; // If the font doesn't exist, or the font size should be changed if (sfFont == null || Math.Abs(font.RealSize - font.Size * Scale) > 2) { FreeFont(font); LoadFont(font); } //if (sfFont == null) // sfFont = global::SFML.Graphics.Font.DefaultFont; // todo: this is workaround for SFML.Net bug under mono if (Environment.OSVersion.Platform != PlatformID.Win32NT) { if (text[text.Length - 1] != '\0') text += '\0'; } Text sfText = new Text(text, sfFont); sfText.Font = sfFont; sfText.Position = new Vector2f(pos.X, pos.Y); sfText.CharacterSize = (uint)font.RealSize; // [omeg] round? sfText.Color = m_Color; m_Target.Draw(sfText); sfText.Dispose(); //m_Target.RestoreGLStates(); }
public void RenderText(IRenderTarget destination, Point position, string text, int characterSize, Color color, bool bold, bool italic, bool underline) { // todo: this is workaround for SFML.Net bug under mono if (Environment.OSVersion.Platform != PlatformID.Win32NT) { if (text[text.Length - 1] != '\0') text += '\0'; } Text sfText = new Text(text, font); sfText.Position = new Vector2f(position.X, position.Y); sfText.CharacterSize = (uint)characterSize;//(uint)font.RealSize; // [omeg] round? sfText.Color = new SFML.Graphics.Color(color.R, color.G, color.B, color.A); if (bold) sfText.Style |= Text.Styles.Bold; if (italic) sfText.Style |= Text.Styles.Italic; if (underline) sfText.Style |= Text.Styles.Underlined; RenderTarget targetTexture = destination as RenderTarget; targetTexture.FlushCache(); targetTexture.m_RenderState.Texture = null; targetTexture.Draw(sfText); sfText.Dispose(); }
public void Dispose() { _text.Dispose(); GC.SuppressFinalize(this); }