0
\$\begingroup\$

Here is my Game1.Draw() method (Constants.HeroLayerDepth is equal to 1):

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.AntiqueWhite);

        //  gameEngine.DrawEverything(spriteBatch, camera);
        spriteBatch.Begin();

        spriteBatch.DrawString(defaultFont, "Test Field", new Vector2(0, 0),
            Color.Black, 0, new Vector2(0, 0), 0f, SpriteEffects.None, Constants.HeroLayerDepth);

        spriteBatch.End();

        base.Draw(gameTime);
    }

Although I am calling DrawString(), I only see this after running the code:

enter image description here

How can I fix this?

\$\endgroup\$
2
  • \$\begingroup\$ ok, lets check your spriteFont ( i think is defaultFont ), did you add it correctly to pipeline tool?, here you can see a good example: rbwhitaker.wikidot.com/monogame-drawing-text-with-spritefonts \$\endgroup\$ Apr 20, 2018 at 19:45
  • \$\begingroup\$ I have added my sprite font according to this tutorial. The font name is Arial and it used to work, it just doesn’t now \$\endgroup\$
    – Philippe
    Apr 22, 2018 at 5:32

2 Answers 2

0
\$\begingroup\$
spriteBatch.DrawString(defaultFont, "Test Field", new Vector2(0, 0),
        Color.Black, 0, new Vector2(0, 0), 1f, SpriteEffects.None, Constants.HeroLayerDepth);

The problem is the ‘scale’ parameter: it is set to zero in your code.

\$\endgroup\$
0
\$\begingroup\$

Sry, cant make comments. But is the base.Draw(gameTime); pheraps going to another overiding class that may make a GraphicsDevice.Clear(Color.AntiqueWhite);?

(oh, this was an old question, guess you've moved along by now)

\$\endgroup\$
1
  • \$\begingroup\$ Yeah, I have fixed this bug. The problem was actually somewhere in the arguments, but I forgot where \$\endgroup\$
    – Philippe
    May 18, 2018 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .