private void RenderAsFontText(Font font) { description = font.Description; description.Generate(Text, HorizontalAlignment.Center); Add(font.Material); Add(description.Glyphs); Add(description.DrawSize); OnDraw<FontRenderer>(); }
public override void Preview(string contentName) { verdana = ContentLoader.Load<Font>("Verdana12"); new FontText(verdana, "Play", Rectangle.One); sound = ContentLoader.Load<Sound>(contentName); var trigger = new MouseButtonTrigger(); trigger.AddTag("temporary"); var soundCommand = new Command(() => sound.Play(1)).Add(trigger); soundCommand.AddTag("temporary"); }
public FontText(Font font, string text, Rectangle drawArea) : base(drawArea) { // ReSharper disable DoNotCallOverridableMethodsInConstructor once Add(text); if (font.WasLoadedOk) RenderAsFontText(font); else RenderAsVectorText(); Add(new FontName(font.Name)); }
public override void Preview(string contentName) { verdana = ContentLoader.Load<Font>("Verdana12"); new FontText(verdana, "Play/Stop", Rectangle.One); music = ContentLoader.Load<Music>(contentName); music.Play(1); var trigger = new MouseButtonTrigger(); trigger.AddTag("temporary"); var musicCommand = new Command(() => //ncrunch: no coverage start { if (music.IsPlaying()) music.Stop(); else music.Play(1); }).Add(trigger); musicCommand.AddTag("temporary"); //ncrunch: no coverage end }
public FontText(Font font, string text, Vector2D centerPosition) : this(font, text, Rectangle.FromCenter(centerPosition, new Size(0.3f, 0.1f))) { }
private void CreateText() { font = Font.Default; history = new FontText(font, "", Rectangle.Zero) { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom }; command = new FontText(font, "> _", Rectangle.Zero) { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; autoCompletions = new FontText(font, "", Rectangle.Zero) { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; }