a friend of mine is workin on a game in sdl where before it starts up, it
asks you if you want full screen or not and if you want sound (in a text
window) and then it fires up the game.
while the game is running you can type commands to the text window for
debugging purposes.
i was wondering…how do you make this happen instead of everything going to
stdout.txt? This is in windows btw (:
The last time I did something similar to this I did it in Perl, which
made life very easy. It works something like this;
Read the line of input (the ‘command’)
Split the input line by whitespace (possibly handling quoted input as
one)
Use the first token as the command to execute (made useful in Perl as
a hash can specify which function to execute) and pass the rest of the
arguments to the function (usually you extract the first array element
and just pass the entire array to the function).
Voila.
HTH,
MattOn Mon, 2004-03-08 at 02:28, Alan Wolfe wrote:
hello,
a friend of mine is workin on a game in sdl where before it starts up, it
asks you if you want full screen or not and if you want sound (in a text
window) and then it fires up the game.
while the game is running you can type commands to the text window for
debugging purposes.
i was wondering…how do you make this happen instead of everything going to
stdout.txt? This is in windows btw (:
im talking about an interactive command window, not just a settings file,
thanks though (:> ----- Original Message -----
From: matt@mattsscripts.co.uk (Matt Wilson)
To:
Sent: Sunday, March 07, 2004 7:26 PM
Subject: Re: [SDL] command window
On Mon, 2004-03-08 at 02:28, Alan Wolfe wrote:
hello,
a friend of mine is workin on a game in sdl where before it starts up,
it
asks you if you want full screen or not and if you want sound (in a text
window) and then it fires up the game.
while the game is running you can type commands to the text window for
debugging purposes.
i was wondering…how do you make this happen instead of everything
going to
stdout.txt? This is in windows btw (:
The last time I did something similar to this I did it in Perl, which
made life very easy. It works something like this;
Read the line of input (the ‘command’)
Split the input line by whitespace (possibly handling quoted input as
one)
Use the first token as the command to execute (made useful in Perl as
a hash can specify which function to execute) and pass the rest of the
arguments to the function (usually you extract the first array element
and just pass the entire array to the function).
my problem isnt parsing the commands, its that in windows, using mingw, my
sdl applications have no text command window, all printf’s end up in
stdout.txt so i cant input/output with the user ):
kinda sucks> ----- Original Message -----
From: matt@mattsscripts.co.uk (Matt Wilson)
To:
Sent: Sunday, March 07, 2004 7:26 PM
Subject: Re: [SDL] command window
On Mon, 2004-03-08 at 02:28, Alan Wolfe wrote:
hello,
a friend of mine is workin on a game in sdl where before it starts up,
it
asks you if you want full screen or not and if you want sound (in a text
window) and then it fires up the game.
while the game is running you can type commands to the text window for
debugging purposes.
i was wondering…how do you make this happen instead of everything
going to
stdout.txt? This is in windows btw (:
The last time I did something similar to this I did it in Perl, which
made life very easy. It works something like this;
Read the line of input (the ‘command’)
Split the input line by whitespace (possibly handling quoted input as
one)
Use the first token as the command to execute (made useful in Perl as
a hash can specify which function to execute) and pass the rest of the
arguments to the function (usually you extract the first array element
and just pass the entire array to the function).
Fixing this in vc++ needs the linker to make a console exe instead of a windows one. (I just figured this out last night!) The option is: /subsystem:console (vs /subsystem:windows).
I did a quick google search on mingw and subsystem about this and the option seems to be: --subsystem,console
There is also a define in vc++ that is used, but I’m not sure how it affects it. It may not apply for mingw. It’s _CONSOLE and _WINDOWS so you may need to do a -D_CONSOLE.
This gets rid of the .txt’s and uses the console as your stdin/out, so a function like gets() should work for your needs!
Gerald> ----- Original Message -----
From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Alan Wolfe
Sent: Monday, 8 March 2004 1:29 PM
To: sdl at libsdl.org
Subject: [SDL] command window
hello,
a friend of mine is workin on a game in sdl where before it starts up, it
asks you if you want full screen or not and if you want sound (in a text
window) and then it fires up the game.
while the game is running you can type commands to the text window for
debugging purposes.
i was wondering…how do you make this happen instead of everything going to
stdout.txt? This is in windows btw (:
my problem isnt parsing the commands, its that in windows, using mingw, my
sdl applications have no text command window, all printf’s end up in
stdout.txt so i cant input/output with the user ):
Sorry I didn’t hit the nail on the head. Whenever the interaction window
is ‘open’ re-route all input characters to it (rather than the game’s
input handler) then just append all non-eol character onto a string.
When an eol is caught you have your command in said string, then just
parse as normal. HTH a little more :)On Mon, 2004-03-08 at 04:35, Alan Wolfe wrote:
----- Original Message -----
From: “Matt Wilson” <@Matt_Wilson>
To:
Sent: Sunday, March 07, 2004 7:26 PM
Subject: Re: [SDL] command window
On Mon, 2004-03-08 at 02:28, Alan Wolfe wrote:
hello,
a friend of mine is workin on a game in sdl where before it starts up,
it
asks you if you want full screen or not and if you want sound (in a text
window) and then it fires up the game.
while the game is running you can type commands to the text window for
debugging purposes.
i was wondering…how do you make this happen instead of everything
going to
stdout.txt? This is in windows btw (:
The last time I did something similar to this I did it in Perl, which
made life very easy. It works something like this;
Read the line of input (the ‘command’)
Split the input line by whitespace (possibly handling quoted input as
one)
Use the first token as the command to execute (made useful in Perl as
a hash can specify which function to execute) and pass the rest of the
arguments to the function (usually you extract the first array element
and just pass the entire array to the function).