• Advertisement

Archived

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

Quake like console question...

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

Ok, i''ve sniffed around these forums and have been looked at the Quake/Quake 2 source among others to see how they implement their consoles but being a newbie am having trouble understanding a few things. Onto my main query. As it stands, I am using a two-dimensional array which holds the number of lines + the contents i.e. char line_buffer[15][64]; Any input is put into line_buffer[0] and when the user hits return all the strings are copied from the top to bottom so it gives the effect they have been "shunted" up one. This presents a problem when I want to add info onto the buffer like memory values etc that the user hasn''t entered (for instance their typed buffer will be effectively be cancelled out). So I was thinking of using a separate array for the userinput and what has already been added to the console buffer. I''m thinking this would allow me better use of the memory aswell - I could have a loop using the modulus operator so any new input can be buffered into the line that was just knocked off the "top" as such). I hope that made sense. Anyone have a better way of doing such a console? I''m kinda stuck here... :]

Share this post


Link to post
Share on other sites
Advertisement
Instead of having big 2d arrays you could allocate the memory as needed, as long as you are handy with pointers and the new keyword.

Share this post


Link to post
Share on other sites

  • Advertisement