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.

Code Snippets / [DBP] - In Game Debugging Console

Author
Message
Coldfire
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 7th Feb 2011 21:54 Edited at: 7th Feb 2011 21:55
Hello,
A while ago I found myself wanting to create a feedback system in game for displaying debugging information without having to exit my projects. From this, a simple console was born. Until today it was only used for displaying information, but I decided to try my hand at a input system for it in case I decide to use it with a Lua project.

Unfortunately, I have not created a parsing system as I will not be in need of such a thing. It shouldn't be difficult at all to create console methods with single parameters if you want to take a stab at it. If I got time, I may toss up an example showing how, but I can't promise anything.

I have the console system set up as an include library and also have a small demo program to show off its functionality.

Console Demo.dba



Console.dba



To activate the console, use the tilde(`/~) key. To increase or decrease the size of the console, use the +/= and -/_ keys respectively.

Screenshot:

Attachments

Login to view attachments
Coldfire
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 8th Feb 2011 02:59
Here's a video of it in action. I plugged Unity into it by simply taking the console message string and using 'lua execute' on it. It took a whole 2 lines

http://www.youtube.com/watch?v=zXz7CAKkst4
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 13th Feb 2011 09:56
Damn! Thats epic! Epic Epic Epic!

Coldfire
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 13th Feb 2011 13:11
Thanks for the comment! It also works really well with Cloggy's D3dfunc 3.0 with a little modification, and of course that would allow for alpha transparency.

I actually wrote my own dot command that would sample the underlying color and blend it by a percentage with the ink color, but that was more of a proof of concept then anything else. Even using lock/unlock pixels, it ran at a whopping 8 fps, lol, so I figured I'd take that out.

Thanks again!

Randy
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 13th Feb 2011 19:38 Edited at: 13th Feb 2011 19:42
Still works perfect .

I wonder if there wil be a version for DarkGDK.

Good luck with this!

Edit: You typed your name wrong in the console window.

Coldfire
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 14th Feb 2011 05:15 Edited at: 14th Feb 2011 05:50
Actually I wasn't planning on releasing it, but I already have one, lol. In its current state, it just manages 2 stl vector objects. One for the console messages, and another that store a user defined "type" integer that you can use to set or determine what kind of console message it should be.

With that being said, that version was intended to be separate from a graphical console. I did however make a small sample which uses my console library as well as the Dark GDK version of Cloggy's d3dfunc. I'll take a look and see if I can find it real quick then I'll post it.

Edit: Alright, here it is. As I said before, you'll need Cloggy's d3dfunc for Dark GDK for my example but I'd recommend taking the console.h by itself if you plan on using it. That way you can design your own graphic interface to it. One thing i never got around to is creating a console dump function but that could be easily added by just about anyone with a little C knowledge.

main.cpp


console.h


gconsole.h, my graphical console


To use the sample, create a new Dark GDK project and add d3dfunc library. Replace the projects "main.cpp" with the one above and also create and copy over the other two headers.

My GConsole namespace was never meant to be actually used and as such I have some hard coded input functions inside the draw function. The controls to pull down/push up the console are CTRL+Down Arrow, and CTRL+Up Key respectively.

I've also attached a EXE in case anyone doesn't want to bother with compiling.

@RedEye: As for misspelling my name, I have no good excuse for that, lol. I've been terrible with typing lately. Thats what I get for mixing programming with beer and/or vodka, lol.

Note to Moderators: If possible, please change the tag of topic from [DBP] to [DBP][DGDK]. I wasn't originally planning on it being for both

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-14 15:19:46
Your offset time is: 2024-04-14 15:19:46