drop-down console

Started by
4 comments, last by Knuckler 16 years, 11 months ago
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 =)
http://www.terranexus.ca/
Advertisement
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.
Check out my devlog.
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!
Member of the NeHe team.
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?
http://www.terranexus.ca/
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 :(
Member of the NeHe team.
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

This topic is closed to new replies.

Advertisement