Clearing the drawn SpriteFont in XNA 4.0

590 views Asked by At

This code is used to basically display number of times the user touches the screen. But the problem is every time the Update method(XNA 4.0), the previous texture is Drawn upon , therefore the count cannot be read. How do i clear the SpriteFont texture each time when it is redrawn?.

//Code used to draw the Sprite Font.!
batch.DrawString(fontSegoe, "Touches "+count, new Vector2(100, 100), Color.Black, 0, Vector2.Zero, 1, SpriteEffects.None, 0f);
1

There are 1 answers

1
Zyumar On

Make sure to clear the screen at the beginning of Draw()

GraphicsDevice.Clear(Color.Black); //Use any color of your choice