Sign in to follow this  

window console logging

This topic is 4667 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

can someone point me to a website or a tutorial that can show me how to set up a logging console window like quake3 has. im not talking about the console that you can press the '~' key and get while in the game. im talking about the one that pops up a few seconds before the GL window renders. i need something i can run on my 2nd monitor so i can make adjustments to my engine on the fly. any places i should start looking?

Share this post


Link to post
Share on other sites
One thing you should keep in mind is that when the game runs full screen, direct x will blank out the other screen unless it is specifically told to use it.

The quake-style console (not ~) can be attained by MFC, Managed C++, C#, VB.NET, and a half dozen other languages.. its really just a window which is spawned by the program and messages (i.e. WM_MY_MESSAGE) can be sent to the window to control it.

If your game runs in windowed mode I dont see why you couldent spawn the window and the game window at the same time (specifying rectangle coordinates for the location on the 'combined' screen.

I'm not 100% sure on how windows addresses this when say the ATI Driver creates one big desktop as opposed to just another work area to place windows. A good place to start would be MSDN.

www.msdn.com

Share this post


Link to post
Share on other sites
Below is a console class I wrote and use. It just opens up a dos window that you can easily write to. It's really no good if you're doing stuff in full screen mode. It should really only be used strictly for logging in debug mode.

If it fits your needs it's really handy and simple to use.. eg-

Console::write("Here is string: %s and in integer: %i written to the console","testing",5);


#ifndef CONSOLE_H
#define CONSOLE_H

#include <windows.h>
#include <string.h>

class Console
{
public:
void static write(char* szText, ...)
{
static HANDLE* lpConsole = NULL;
static char szBuffer[1000];

if (!lpConsole)
{
AllocConsole();
lpConsole = (HANDLE*)GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTitle("Debug");
}

va_list argList;
va_start(argList, szText);
vsprintf(szBuffer, szText, argList);
va_end(argList);

WriteConsole(lpConsole,szBuffer,(int)strlen(szBuffer),NULL,NULL);
WriteConsole(lpConsole,"\n",1,NULL,NULL);
}
};

#endif

Share this post


Link to post
Share on other sites
right now im just looking for a place that i can learn how to do it in just basic c. i learned basic c and c++ console stuff in high school and i taught myself everything else from there. i never learned how to make a window and child windows and that kind of stuff. the messaging system and sending them between windows confuses me thats why i want to learn more about them.

Share this post


Link to post
Share on other sites
actually let me rephrase my question. im mainly looking for a simple function that can read in a single character at a time and process it. ive been using getchar() but it seems that it overloads the char variable i have it set with. ill sit and type a string of info and press enter for an echo and the entire string spits back out.

Share this post


Link to post
Share on other sites
Hey again adam17! I just wanted to say, I've noticed all your posts happen to be in this "NeHe Productions" forum. There is nothing wrong with that, except you might be able to get more useful help in the 'General Programming' or 'For Beginners' forums [smile].

Ok now for your program that does this, what you are doing is attaching a console window to the windows program, if I understand you correctly. There is a link that was posted not too long ago that I remember does this. I'll see if I can dig it up real fast.

[edit] Ok here it is, complements to Oluseyi from this post

[Edited by - Drew_Benton on March 9, 2005 5:19:51 PM]

Share this post


Link to post
Share on other sites

This topic is 4667 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this