private void drawCountDown() { // draw current digit of countdown based on CountDown class _spriteBatch.Begin(); int digit = CountDown.curDigit; Rectangle digitRect = SourceRectangle.numberRectangle(digit); _spriteBatch.Draw(textTexture, new Vector2(12 * Global.PICTURESIZE, 13 * Global.PICTURESIZE), digitRect, Color.White); _spriteBatch.End(); }
private void drawScore(int offsetX, int textLine) { // draws number at a given offset // offset of the LAST digit given int points = gamePlan.curPoints; while (points > 0) { int digit = points % 10; Rectangle digitRect = SourceRectangle.numberRectangle(digit); _spriteBatch.Draw(textTexture, new Vector2(offsetX, textLine), digitRect, Color.White); offsetX -= Global.PICTURESIZE; points /= 10; } }
private void drawLivesAndScore() { // draws words "lives" and "score", draws score _spriteBatch.Begin(); int textLine = 24 * Global.PICTURESIZE; // offset on Y axis of the line with text _spriteBatch.Draw(textTexture, new Vector2(1 * Global.PICTURESIZE, textLine), SourceRectangle.lives, Color.White); _spriteBatch.Draw(textTexture, new Vector2(13 * Global.PICTURESIZE, textLine), SourceRectangle.score, Color.White); if (gamePlan.curPoints == 0) { Rectangle zero = SourceRectangle.numberRectangle(0); _spriteBatch.Draw(textTexture, new Vector2(19 * Global.PICTURESIZE, textLine), zero, Color.White); } else { int points = gamePlan.curPoints; int offset = 23 * Global.PICTURESIZE; drawScore(offset, textLine); } _spriteBatch.End(); }