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-05-11 10:53:20 +0000
committerStijn Buys <ingar@osirion.org>2008-05-11 10:53:20 +0000
commitd82c8f449c604d0f957e3dd190f7beae3596e6f9 (patch)
treee64ad617cd609437f2177922e3d90693fa38940d /src/client/chat.cc
parentfb227d62e699ebaea6e428f570bedc684873f15b (diff)
brute force line wrapping
Diffstat (limited to 'src/client/chat.cc')
-rw-r--r--src/client/chat.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/chat.cc b/src/client/chat.cc
index fc0ce1b..4d2f759 100644
--- a/src/client/chat.cc
+++ b/src/client/chat.cc
@@ -8,6 +8,7 @@
#include "client/chat.h"
#include "client/console.h"
#include "client/keyboard.h"
+#include "client/video.h"
#include "render/render.h"
namespace client {
@@ -73,6 +74,11 @@ void draw()
if (console::visible() || !visible())
return;
+ size_t width = (size_t) (video::width / CHARWIDTH) - 7;
+ size_t draw_pos = 0;
+ while (input_pos - draw_pos > width)
+ draw_pos += 2;
+
// draw the console input
gl::color(1.0f, 1.0f, 1.0f, 1.0f);
draw_text(CHARWIDTH , 4 + CHARHEIGHT * (MAXNOTIFYLINES+1), "say");
@@ -80,12 +86,12 @@ void draw()
draw_text(CHARWIDTH*4 , 4 + CHARHEIGHT * (MAXNOTIFYLINES+1), ":");
gl::color(1.0f, 1.0f, 1.0f, 1.0f);
- draw_text(CHARWIDTH*6, 4 + CHARHEIGHT * (MAXNOTIFYLINES+1), (*history_pos));
+ draw_text(CHARWIDTH*6, 4 + CHARHEIGHT * (MAXNOTIFYLINES+1), (*history_pos).substr(draw_pos, width));
// draw cursor
if ((core::application()->time() - ::floorf(core::application()->time())) < 0.5f) {
std::string cursor("_");
- draw_text(CHARWIDTH*(input_pos+6), 4 + CHARHEIGHT * (MAXNOTIFYLINES+1) , cursor);
+ draw_text(CHARWIDTH*(input_pos - draw_pos+6), 4 + CHARHEIGHT * (MAXNOTIFYLINES+1) , cursor);
}
}