示例#1
0
		private void RenderAsFontText(Font font)
		{
			description = font.Description;
			description.Generate(Text, HorizontalAlignment.Center);
			Add(font.Material);
			Add(description.Glyphs);
			Add(description.DrawSize);
			OnDraw<FontRenderer>();
		}
示例#2
0
 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");
 }
示例#3
0
 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));
 }
示例#4
0
 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
 }
示例#5
0
 public FontText(Font font, string text, Vector2D centerPosition)
     : this(font, text, Rectangle.FromCenter(centerPosition, new Size(0.3f, 0.1f)))
 {
 }
示例#6
0
 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
     };
 }