Page 1 of 1
Using the Console Window With SDL
Posted: Mon May 31, 2010 3:31 am
by XianForce
So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 8:59 am
by Ginto8
XianForce wrote:So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
If by "console window" you mean the terminal that comes up when you sometimes start the app, you can't really use it, primarily due to the fact that stdout and stderr are both redirected to files by SDL. If you mean an in-game console, lazyfoo has a tutorial on text input in SDL:
http://www.lazyfoo.net/SDL_tutorials/lesson23/index.php
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 11:31 am
by XianForce
Ginto8 wrote:XianForce wrote:So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
If by "console window" you mean the terminal that comes up when you sometimes start the app, you can't really use it, primarily due to the fact that stdout and stderr are both redirected to files by SDL. If you mean an in-game console, lazyfoo has a tutorial on text input in SDL:
http://www.lazyfoo.net/SDL_tutorials/lesson23/index.php
I meant the terminal. And I know it's rerouted, but I thought there was a way to 're'reroute it... hmmm
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 12:14 pm
by combatant936
If you're using Visual Studio you can set it up to use the console window.
Go to project->properties and under configuration properties go to linker then system.
Where it says "SubSystem", change that to "Console (/SUBSYSTEM:CONSOLE)".
That will make a console window come up along with the SDL window and you can use iostream or whatever you want.
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 12:22 pm
by dandymcgee
XianForce wrote:Ginto8 wrote:XianForce wrote:So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
If by "console window" you mean the terminal that comes up when you sometimes start the app, you can't really use it, primarily due to the fact that stdout and stderr are both redirected to files by SDL. If you mean an in-game console, lazyfoo has a tutorial on text input in SDL:
http://www.lazyfoo.net/SDL_tutorials/lesson23/index.php
I meant the terminal. And I know it's rerouted, but I thought there was a way to 're'reroute it... hmmm
Code: Select all
freopen( "CON", "w", stdout );
freopen( "CON", "w", stderr );
Toss that in there somewhere. Works for output.
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 12:44 pm
by davidthefat
If you use codeblocks, the debug build always has the console window, the release build does not
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 12:53 pm
by Falco Girgis
Both visual studio and xcode still allow virtual terminals for standard output with the correct type of project...
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 1:25 pm
by XianForce
GyroVorbis wrote:Both visual studio and xcode still allow virtual terminals for standard output with the correct type of project...
Wow... Are you kidding me?
I just tried it and it worked.
I tried it like a few months ago and got a BSOD... lol
Well thanks for that then
Re: Using the Console Window With SDL
Posted: Mon May 31, 2010 3:50 pm
by eatcomics
XianForce wrote:
I tried it like a few months ago and got a BSOD... lol
there's no way your program did that, there's something else going on there