how to print a text string onto screen?
how to print a text string onto screen?
i just need to show something like FPS
Re: how to print a text string onto screen?
If you're using XNA, the SpriteBatch supports simple text drawing. Nothing specifically BEPUphysics related supports text drawing (or general graphics for that matter).
Re: how to print a text string onto screen?
thank you Norbo for the quick reply.
I tried to use spriteBatch.DrawString(). Then, the graphics with BEPU engine messed up.
The attachment pictures show the scene before and after using spriteBatch to draw texts.
The code Draw function is like this :
I tried to use spriteBatch.DrawString(). Then, the graphics with BEPU engine messed up.
The attachment pictures show the scene before and after using spriteBatch to draw texts.
The code Draw function is like this :
Code: Select all
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.BlendState = BlendState.AlphaBlend;
GraphicsDevice.Clear(Color.CornflowerBlue);
scene.Draw(gameTime);
spriteBatch.Begin();
DrawText("this is a good text example");
spriteBatch.End();
base.Draw(gameTime);
}
- Attachments
-
- This is the scene AFTER introducing spriteBatch text drawing
- after.PNG (30.59 KiB) Viewed 5287 times
-
- This is the scene BEFORE introducing spriteBatch text drawing
- before.PNG (35.96 KiB) Viewed 5287 times
Re: how to print a text string onto screen?
Mixing 2D/3D needs this:
(see http://rbwhitaker.wikidot.com/2d3d-combined for more details)
Hope this help.
Code: Select all
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true };
Hope this help.
Re: how to print a text string onto screen?
thank you, JusTiCe8. that works.