Skip to main content
GameDev.net gamedev.net
🔒 Locked

Console + Graphics

Started by NN Apr 18, 2001 at 9:07 PM 7 replies 950+ views
Original Post
NN
NN
Well, wasn''t that a cryptic title...oh well. I''m trying to add a console window to my OGL prog., like a popup window. Is there any way to run DOS w/ a cmd from the main window? There''s a tut for it on this site, but it uses DDraw, which I don''t really want to use. I''m mainly trying to avoid all DX. I''ll post my game somewhere when I''m done. Just look for something like ''Project: SPACE'', or ''Space'' on this site. Back on topic, help anyone? Thx In Advance, NN
KalvinB
KalvinB
The command window isn''t a DOS window. It''s a specialized text display requiring a specialized interpreter. When the window is open you basically redirect all keyboard input to a string and then when the user hit''s a predefined key, usually enter, the string is parsed and the commands are executed.

All you need to know how to do is keyboad input, text display, background image if you want, and how to parse the input.

Ben
http://therabbithole.redback.inficad.com

NN
NN
Anonymous Poster: I don''t get what you mean by ''using standard functions''. Like cin and cout and stuff like that? And how would that affect the gfx in the window, as DOS is procedure... I don''t get it...

KalvinB: That sounds like it would work, but I''m talking about using the console to load levels, like in DOS. Iz that parsing? I''m sorta new... I saw an article on flipcode about implementing a SCRIPTING ENGINE, but...

PS: What are the window properties?

I''m gonna feel really stupid when someone replies to this...
OctDev
OctDev
Hi--

I am fairly new to OpenGl, so not really in a position to help with your main question. About parsing though:

Parsing basically means interpreting. This extends to interpreting language, which extends in this case to interpreting commands. Generically, when you write a program and then try and compile it, your compiler goes through several stages before generating the code. One of these steps is called parsing, where it basically abstracts all of your code and interprets this (based in the language specification which is typically put into a grammar of some sort). For you, parsing consists of grabbing a line of input from the user, breaking it apart, and interpreting it. DOS example:

>cd c:\WINDOWS

gets parsed and becomes two variables, cd and c:\WINDOWS. cd gets mapped to ''command'', where c:\WINDOWS gets mapped to argument. Then you match the command, and pass in the argument, which happens in this case to be the pathname. If you can''t match the command, you error. If you have the wrong type (or number) of arugments, you error. Otherwise, if it checks out, you execute the code for that command, and pass it that argument.

Anyway, I believe that what Kalvin was saying was to parse the command, and then send it to "a specialized interpreter." I am not sure how that interpreter works or is called, or if you are supposed to write it, because I am not experienced enough with OpenGl yet. But, this overly long ramble is the easiest generic description of parsing I could come up with for you.

--OctDev
The Tyr project is here.
Staffan
Staffan
quote:
Original post by NN

Anonymous Poster: I don''t get what you mean by ''using standard functions''. Like cin and cout and stuff like that? And how would that affect the gfx in the window, as DOS is procedure... I don''t get it...




Yes he meant standard functions such as cout and printf - which are not DOS procedures. It won''t affect your other window at all. Just do as AP said, create your window and use printf(), clog and god knows what like you always did.

WinMain is just a scam anyways, it - the program - always goes into the main() function first, always!


"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album
Staffan
Staffan
Wait, I just realized you wanted a quake-ish dropdown console (or whatever), right, so just disregard from my last post. Using the standrard console would only be helpful for debugging and informational purposes, or if you were to run your game in windowed mode...


"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album
NN
NN
Could I draw the window and display text? And then on key take user input...oh wait, that''s what KalvinB said...I could use something like:

if(consoleinput == /*predefined message like load Nuclear Waste*/
{
//display text
}
else if(____)
...

but that would be really time taking...Oh well, back to the drawing board...

merlin9x9
merlin9x9
Da***t, people, just because you see a command-line interface doesn't mean it's DOS! DOS is an operating system, not an interface!

The command line in Windows is the Win32 console!

Edited by - merlin9x9 on April 21, 2001 11:58:07 AM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.