hud messages

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1440 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2007-11-25 10:03:04 +00:00
parent e39e1cf8eb
commit d2a331fd4a
6 changed files with 119 additions and 69 deletions
+27
View File
@@ -0,0 +1,27 @@
struct cline { char *cref; int millis; };
struct consolebuffer
{
vector<cline> conlines;
void addline(const char *sf, bool highlight, int millis) // add a line to the console buffer
{
cline cl;
cl.cref = conlines.length()>100 ? conlines.pop().cref : newstringbuf(""); // constrain the buffer size
cl.millis = millis; // for how long to keep line on screen
conlines.insert(0,cl);
if(highlight) // show line in a different colour, for chat etc.
{
cl.cref[0] = '\f';
cl.cref[1] = '0';
cl.cref[2] = 0;
s_strcat(cl.cref, sf);
}
else
{
s_strcpy(cl.cref, sf);
}
}
virtual void render() = 0;
};