Console Buffer

Started by
6 comments, last by Luke Philpot 20 years, 3 months ago
Hey guys I''ve been thinking about what the best way to handle a console buffer would be. I was wondering if I could get some ideas on how you guys do it in your engines. Thanks My Website | Everything you need to know about 3D Graphics | Google | Search the Forums
Advertisement
I can think of at least four things off the top of my head that you could call a console buffer: a display text buffer, a display pixel buffer, an input text buffer and a command history buffer.

So I guess my question would be, which kind of buffer are you thinking about?
"Command history buffer" sounds right

You know, drop down the console in Quake, it''s got a list of the commands and their output you''ve typed in.

My Website | Everything you need to know about 3D Graphics | Google | Search the Forums
No, actually that sounds like the display text buffer. For that I would use a std::deque<std::pair<int, std::string> > to store the displayed lines. The int would contain the formatting information for the line (if it was input or output from the command line, a chat message, an in game diagnotistic, etc.) and the string would contain the actual line itself. Whenever something is added to the display, it would be pushed on the back, and display would be done front to back in the deque. When the buffer gets full, it's popped from the front.

edit: !#@# smile code

[edited by - SiCrane on January 4, 2004 1:01:43 AM]
Hmmm, that sounds like a great idea. I''ll look into it.

My Website | Everything you need to know about 3D Graphics | Google | Search the Forums
I basicly have a text-buffer. std::vector< std::string >
And I store hundred lines of the console in there.

That deque / pair idea was pretty neat. I might implent that, because that way you could have the styles or colors stored there too pretty easily.
________________________________________Kloonigames Blog - Monthly Experimental Games
What would be even better is to store a simple class lets call it Text. Then this class can contain your string and also the formating and your not limited in any way if you want to change your implementation at a later date.

James
SiCrane, that works perfectly! Thanks!

My Website | Everything you need to know about 3D Graphics | Google | Search the Forums

This topic is closed to new replies.

Advertisement