Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-23 17:10:35 +0000
committerStijn Buys <ingar@osirion.org>2008-02-23 17:10:35 +0000
commit5c734fe66e9ace93c03937adc2fc56336fb474fb (patch)
treed4d4ffebd4215b0f1f42d6a4ac9275ec8cd686ea /src/client/console.cc
parent82c06412ef39522c4deab457ce7a3e78160d8a19 (diff)
client chatbox and message notifications
Diffstat (limited to 'src/client/console.cc')
-rw-r--r--src/client/console.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/client/console.cc b/src/client/console.cc
index 85cb72e..3954d45 100644
--- a/src/client/console.cc
+++ b/src/client/console.cc
@@ -21,6 +21,7 @@ namespace console {
//--- private definition ------------------------------------------
+
/// private client console implementation
class Console : public sys::ConsoleInterface {
public:
@@ -52,16 +53,23 @@ std::deque<std::string>::reverse_iterator history_pos;
size_t input_pos = 0;
// console visibility
-bool console_visible;
+bool console_visible = false;
size_t console_scroll = 0;
+// notifications
+size_t notify_pos = 0;
+std::string notify_text[MAXNOTIFYLINES];
+float notify_time[MAXNOTIFYLINES];
+
//--- engine functions --------------------------------------------
-void func_con_toggle(std::stringstream &args)
+void func_con_toggle(std::string const &args)
{
+ std::istringstream argstream(args);
int i;
- if (args >> i) {
+
+ if (argstream >> i) {
if (i) console_visible = true; else console_visible = false;
} else
console_visible = !console_visible;
@@ -109,7 +117,6 @@ void draw()
{
using namespace render;
- flush();
if(!console_visible)
return;
@@ -184,6 +191,13 @@ void flush()
text.pop_front();
}
text.push_back(std::string(line));
+
+ // save notification
+ notify_text[notify_pos] = line;
+ notify_time[notify_pos] = sys::time();
+ notify_pos = (notify_pos+1) % MAXNOTIFYLINES;
+
+ // print to stdout
std::cout << line << std::endl;
}
@@ -193,7 +207,6 @@ void flush()
void toggle()
{
console_visible = !console_visible;
- setkeyboardmode(console_visible);
if (console_visible) {
console_scroll = 0;