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 (:

Thanks!
Alan

The last time I did something similar to this I did it in Perl, which
made life very easy. It works something like this;

  1. Read the line of input (the ‘command’)
  2. Split the input line by whitespace (possibly handling quoted input as
    one)
  3. 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).
  4. 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 (:


http://www.mattsscripts.co.uk/

  • A great source for free CGI and stuff

Alcohol, hashish, prussic acid, strychnine are weak dilutions. The surest
poison is time.
– Emerson, “Society and Solitude”

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;

  1. Read the line of input (the ‘command’)
  2. Split the input line by whitespace (possibly handling quoted input as
    one)
  3. 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).
  4. Voila.

HTH,

Matt


http://www.mattsscripts.co.uk/

  • A great source for free CGI and stuff

Alcohol, hashish, prussic acid, strychnine are weak dilutions. The surest
poison is time.
– Emerson, “Society and Solitude”


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

err…i reread what you said (:

sorry if i wasnt clear.

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;

  1. Read the line of input (the ‘command’)
  2. Split the input line by whitespace (possibly handling quoted input as
    one)
  3. 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).
  4. Voila.

HTH,

Matt


http://www.mattsscripts.co.uk/

  • A great source for free CGI and stuff

Alcohol, hashish, prussic acid, strychnine are weak dilutions. The surest
poison is time.
– Emerson, “Society and Solitude”


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Alan,

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 (:

Thanks!
Alan


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

err…i reread what you said (:

sorry if i wasnt clear.

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;

  1. Read the line of input (the ‘command’)
  2. Split the input line by whitespace (possibly handling quoted input as
    one)
  3. 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).
  4. Voila.

HTH,

Matt


http://www.mattsscripts.co.uk/

  • A great source for free CGI and stuff

Alcohol, hashish, prussic acid, strychnine are weak dilutions. The surest
poison is time.
– Emerson, “Society and Solitude”


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


http://www.mattsscripts.co.uk/

  • A great source for free CGI and stuff

Q: Why is Mrs. Carter always on top when she and Jimmy make love?
A: Because all Jimmy Carter can do is fuck up.