diff --git a/src/main.c b/src/main.c index 77723cca..16ba0425 100644 --- a/src/main.c +++ b/src/main.c @@ -80,15 +80,17 @@ #endif #if defined(WIN32) - #include - #include +#include +#include +#include +#include #elif defined (__MINT__) - #include +#include #elif defined(__macosx__) - #import - #import +#import +#import #elif defined(__FreeBSD__) - #include +#include #endif #if defined(__macosx__) @@ -985,8 +987,19 @@ int Init_program(int argc,char * argv[]) } } - // Open a console for debugging... - //ActivateConsole(); + if ((unsigned)GFX2_verbosity_level >= (unsigned)GFX2_DEBUG) + { + // Open a console for debugging... + if (AllocConsole()) + { + HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); + int hCrt = _open_osfhandle((long) handle_out, _O_TEXT); + FILE* hf_out = _fdopen(hCrt, "w"); + setvbuf(hf_out, NULL, _IONBF, 2); + *stdout = *hf_out; + *stderr = *hf_out; + } + } #endif Main.image_width=Screen_width/Pixel_width;