Jump to content
  • Advertisement
Sign in to follow this  
Xerpher

drop-down console

This topic is 4066 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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.

Share this post


Link to post
Share on other sites
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
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!