Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Debug Information

Author
Message
Brillig
16
Years of Service
User Offline
Joined: 19th May 2008
Location:
Posted: 20th May 2008 07:46
The dbText function seems rather useless for Debug or HUD information since you can't print out variables within the string.

Has anyone found a good way of printing out variable values on the in-game screen?
waka324
16
Years of Service
User Offline
Joined: 31st Mar 2008
Location:
Posted: 20th May 2008 11:40
I just use the fstream commands to put information in a file for viewing to see what went wrong where something simple like

std::ofstream debug;
debug.open("filename.txt");
debug>>varriable_check<<"\n"<<"place in code";
debug.close();

just make sure multithreading is on in project properties.
tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 20th May 2008 14:41
You can do it this way:



FINAL VERSION RELEASED!!!!
FERSIS
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 20th May 2008 20:16 Edited at: 20th May 2008 20:19
since it is ontopic.
Does VC++ have some function to write to the output window ? so i can avoid the printf use??
thanks

EDIT:typo
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 20th May 2008 20:34
C++ promotes the concept of inserting an object into a stream. For standard output this stream is cout. Standard error is cerr and there's also clog though I haven't figured where that fits.

To send something to the stream you use the << operator.



This would send

This is a string literal This is a stored string 10000

to the standard out stream. The endl at the end is an end line token, which generates a carriage-return/linefeed sequence.

There are other tokens that can be inserted to affect the formatting of the lines but that gets a bit involved and is beyond the scope of this class.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 21st May 2008 18:10
nice tip there lilith!

thats beeter then mine:


Brillig
16
Years of Service
User Offline
Joined: 19th May 2008
Location:
Posted: 22nd May 2008 02:01
sprintf! Great idea!

Thanks guys!

Login to post a reply

Server time is: 2024-09-29 21:26:04
Your offset time is: 2024-09-29 21:26:04