Advertisement

window console logging

Started by March 09, 2005 04:03 PM
4 comments, last by Drew_Benton 19 years, 8 months ago
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?
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
Advertisement
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
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.
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.
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]

This topic is closed to new replies.

Advertisement