I'm just starting with XNA and I wanted to draw Debug Lines around my Texture/Sprite to help me.
Is there an easy way to do it with SpriteBatch? I haven't used the GraphicsDevice yet to draw....
Thanks!
I'm just starting with XNA and I wanted to draw Debug Lines around my Texture/Sprite to help me.
Is there an easy way to do it with SpriteBatch? I haven't used the GraphicsDevice yet to draw....
Thanks!
http://www.xnawiki.com/index.php/Drawing_2D_lines_without_using_primitives
I would suggest to create subclass of SpriteBatch that would have DrawLine and DrawRectangle function and in constructor create 1x1 texture.
Check out this forum post in which the poster details how he is making spriteBatch draw in wireframe mode.
Basically you just need to change your draw code to this;
spriteBatch.Begin(SpriteSortMode.Immediate,BlendState.Opaque);
RasterizerState state = new RasterizerState();
state.FillMode = FillMode.WireFrame;
spriteBatch.GraphicsDevice.RasterizerState = state;
spriteBatch.Draw(sprite, position, Color.White);
spriteBatch.End();
And obviously change "spriteBatch.Draw(sprite, position, Color.White)" to be a loop drawing all of your sprites.