using System; using System.Diagnostics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace FNAF_Clone.GUI; public class TimerUIElement : TextUIElement{ private Stopwatch stopwatch = new(); public TimerUIElement(Point corner1, SpriteFont font) : base(corner1, font) { Text = "00:00.000"; } public override void Update() { if (stopwatch.IsRunning){ Text = stopwatch.Elapsed.ToString("mm\\:ss\\.fff"); // Text = stopwatch.ElapsedMilliseconds.ToString(); } } public void Start() { stopwatch.Start(); } public void Stop() { stopwatch.Stop(); } }