예제 #1
0
 public TextElement(DrawingFont drawingFont, string text, Vector vector, Color color)
 {
     this.DrawingFont = drawingFont;
     this.Position = vector;
     this.Color = color;
     this.Text = text;
 }
        private static TextElement TextElementFromXml(XElement element)
        {
            var fontName = element.Attribute("fontName").Value;
            var text = element.Attribute("text").Value;
            var vector = element.Attribute("vector").Value;
            var color = element.Attribute("color").Value;

            //var font = gameResourceManager.GetDrawingFont(fontName); OnlyXNA
            var font = new DrawingFont { Name = fontName };
            return new TextElement(font, text, MathUtil.ParseVector(vector), MathUtil.ParseColor(color));
        }
예제 #3
0
        public DiagnosticHud(DrawingFont font, DiagnosticHudConfiguration configuration = null)
        {
            this.font = font;
            this.configuration = configuration ?? new DiagnosticHudConfiguration();

            this.finalLines = new List<string>();
            this.fpsLine = new LineConfiguration
            {
                Template = "FPS {0:d} - Update Per Second {1:d}",
                ParameterProviders = new List<Func<object>>
                {
                    () => this.currentGameTime.DrawFps,
                    () => this.currentGameTime.UpdateFps
                }
            };

            this.ViewState = this.configuration.DisplayState;
        }
예제 #4
0
        public TextElement AddText(DrawingFont drawingFont, string text, Vector vector, Color color)
        {
            var textElement = new TextElement(drawingFont, text, vector, color);
            this.elements.Add(textElement);

            return textElement;
        }