Sign in to follow this  
Xerpher

drop-down console

Recommended Posts

Xerpher    122
Hello all, I'm new to game dev in general but have been having a blast. For my project I'd like to add some kind of a drop-down console like quake has. Basically I'm wondering what the best way to do this is. The only idea I've had thus far is to create a flat polygone directly in front of the camera and write text onto that surface. Any wisdom you guys have to offer would be greatly appreciated =)

Share this post


Link to post
Share on other sites
blueapple    162
What I have done in my current project is just having a boolean which indicates whether to draw the console or not.
If it's supposed to be drawn (it's shown), draw a rectangle and the text on top of it.
(I keep the text saved in a std::list).
If that boolean is true, redirect the keyboard input into something that handles console input.

Share this post


Link to post
Share on other sites
Kazade    1019
What you should do is set an orthographic projection before drawing your quad. Then draw the text on top (look at the bitmap font tutorial on NeHe for this).

Internally it will probably be a good idea to store your console history in a vector of strings something like:

vector<string> history;
string currentLine;

Current line would store the text so far. When enter is pressed simply push_back the currentline into the history vector and clear currentline ready for the next input.

For parsing the commands try looking into boost::tokenizer that might be handy, also flipcode's archive's have a couple of articles here and here

On a side note I've just noticed that flipcode has finally gone offline, which is a real shame because there was a lot of information there. I'm glad the wayback machine exists!

Share this post


Link to post
Share on other sites
Xerpher    122
Thanks for the advice! I'm going to give it a try tonight.

I remember looking at flipcode a couple years ago when game development first interested me although I haven't gotten into it until now. Has anybody actually archived everything flipcode had or is it just whatever archive.org cached?

Share this post


Link to post
Share on other sites
Kazade    1019
Until very recently there was a message on the front page saying that the articles would remain online for the foreseeable future. It looks like the only place to access them from now on will be the internet archive :(

Share this post


Link to post
Share on other sites
Knuckler    144
Also, Nehe has sample code you can look at from the download section
http://nehe.gamedev.net/data/downloads/download.asp?letter=N - the second listing

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this