本文整理汇总了C#中SFML.Graphics.Text.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Text.Dispose方法的具体用法?C# Text.Dispose怎么用?C# Text.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.Text
的用法示例。
在下文中一共展示了Text.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderText
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();
}
示例2: RenderText
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();
}