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 / Header file for using a console window to help debug your application!

Author
Message
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 11th Sep 2008 02:30
I thought I would make this general purpose class which spawns a console window along side your main app window, and you can send text output to the window, so it is useful for debugging. You can also use a getInput() method on it which will cause your DBP app to hang until something is typed in the console window and you press enter.

Here is a usage example:




Any bugs/suggestions/critiques? Post away!

TheSturgeon(playing me at chess) : I will use my powers of the horse and pwnzor you.

Attachments

Login to view attachments
zobdos
16
Years of Service
User Offline
Joined: 8th Sep 2008
Location:
Posted: 6th Oct 2008 08:10
You misspelled "initialize".

Very cool though.

I'm going to play around with it a little.
zobdos
16
Years of Service
User Offline
Joined: 8th Sep 2008
Location:
Posted: 6th Oct 2008 08:29
Nice idea. Very useful.

I made a little change to your printLine function so it will work with generic types. Of course you'll need <iostream> for cout.
Anyway, keep tinkering with it.
I might suggest that you overload the stream operators so that they will work with a boom_console object.
Ideally: BoomConsole out; out << "num: " << num << endl;



btw: you misspelled "initialize"
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 15th Nov 2008 12:07
Thanks... works perfect...

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 15th Nov 2008 14:43
http://en.wiktionary.org/wiki/initialise
spelt fine.
Nice idea.
Swordsman
15
Years of Service
User Offline
Joined: 12th Nov 2008
Location: Wigan, England
Posted: 15th Nov 2008 14:48
I think what zobodos is referring to, is industry standardised spelling. As many libraries come from the US, the programming industry tends to spell things the American way.

Hence comes, Initialize, Color, etc.

Still, nice little class there
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 15th Nov 2008 15:05
One ? with this... I want to build a string before I sent it to the console.... how to do that?



Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 15th Nov 2008 17:12
Quote: "One ? with this... I want to build a string before I sent it to the console.... how to do that?"


http://www.cplusplus.com/reference/clibrary/cstring/

I recommend strcopy and strcat.

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th Nov 2008 03:12
Mnemonix, you should probably replace the printf and putchar in the printLine function with just a simple puts, as it's shorter (and more importantly, safer).

Try
20
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 16th Nov 2008 10:59 Edited at: 16th Nov 2008 11:00
Mnemonix,
Very nice, an output (to a file) would be even nicer

Cheers,
-Try
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 26th Feb 2009 07:41
Thanks for the comments on this class. Outputting to a file is easily done with some simple c++ code so I thought it was pointless to make a class to do it. Some people might not be sure how to do this or not even aware that you can do it, so I thought after I wrote it I would drop it in here, so I am glad some people have been making use of it

Mnemonix

Login to post a reply

Server time is: 2024-09-30 19:17:05
Your offset time is: 2024-09-30 19:17:05