Archived

This topic is now archived and is closed to further replies.

Console Buffer

This topic is 5091 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

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?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites