Jump to content
  • Advertisement
Sign in to follow this  
norper

Need help showing multiple variables faster!

This topic is 2503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,
i am after a bit of help, i will leave this question here while i sleep and hope i get the answer by morning tongue.png

Basicly i have took the leap from games in the console over to 2d & xna. I have made a few games now and one thing i could do with when checking all my variables are correct is a method similar to


Console.Write("tester 1 = {0} tester 2 = {1}", tester1, tester2); or
Console.Write( "tester 1 =" + tester1 "tester 2 =" + tester2 "


in the console it was so easy for me to check 15 variables now im having to add a whole long line of code in the draw method just to make sure the variable is correct!

myBatch.DrawString(Arial, "tester1 : " + tester1, new Vector2(200, 100), Color.Red);

is there any work around to this? i hope i make sense and sorry if the code is slightly off i typed it right into here.

(I did just think about writing a debug screen but that will be my backup)

Share this post


Link to post
Share on other sites
Advertisement
If it's just debug output, there's System.Diagnostics.Debug, which provides various Write methods. The debug console in the IDE listens automatically. If you later decided to write your own debug console (it doesn't need to be complicated for what you describe here) then you could always add that as another listener.

Share this post


Link to post
Share on other sites
There are a number of ways of checking variable values.

You can always set a breakpoint and check any values. You can attach a detail pin to the variable or double click the variable and add the variable to the watch list.

You could add them all to a watch list however only the ones in scope will have a value.

TBH the only variables fields properties I have drawstring calls for are for my camera positions etc.

I bug check a new section of code via steeping thru the debugger, this ensures my variables are correct.

If you really needed to assemble a collection of variables to be printed out then you could assemble an array of variable.1.ToString()...etc
You could then loop thru the array with a drawstring call at an added offset for every i++ operation.

I just noticed your last comment about a debug screen. You do realise there is one included with Visual Studio and you can set a breakpoint!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!