public void InitHud() { mHud = new Hud(); //mHud.Button("Click me",10, 10, mHud.Text(() => "Click me (and check log)")) // .OnClick(() => Console.WriteLine("Text button clicked.")); var screenWidth = Game1.Inst.GraphicsDevice.Viewport.Width; var score = (CScore)GetComponentFromEntity <CScore>(player); //var textSize = SpriteFont font = Game1.Inst.Content.Load <SpriteFont>("Fonts/FFFForward"); Vector2 lengthtop = font.MeasureString("Time Left"); Vector2 lengthbottom = font.MeasureString("000"); mHud.Button("timelefttop", screenWidth / 2 - (int)lengthtop.X / 2, 10, mHud.Text(() => { return(string.Format("Time Left:")); }, Color.White)); mHud.Button("timeleftbottom", screenWidth / 2 - (int)lengthbottom.X / 2, 12 + (int)lengthtop.Y, mHud.Text(() => { return(string.Format("{0:000}", (int)(roundTime - passedTime))); }, Color.White)); mHud.Button("score", screenWidth - 60, 80, mHud.Text(() => { return(string.Format("Score: {0}", score.Score)); }, Color.White), horAnchor: Hud.HorizontalAnchor.Right); var heart = (CHealth)Game1.Inst.Scene.GetComponentFromEntity <CHealth>(player); for (int i = 0; i < heart.Health; i++) { mHud.Button("heart" + i, screenWidth - 50 - i * 50, 0, mHud.Sprite("Textures/Heart", 0.15f), vertAnchor: Hud.VerticalAnchor.Center, horAnchor: Hud.HorizontalAnchor.Right); } }