diff options
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | TODO | 15 | ||||
-rw-r--r-- | osirion.kdevelop.pcs | bin | 655486 -> 655559 bytes | |||
-rw-r--r-- | osirion.kdevses | 21 | ||||
-rw-r--r-- | src/client/chat.cc | 10 | ||||
-rw-r--r-- | src/client/console.cc | 31 | ||||
-rw-r--r-- | src/client/view.cc | 36 |
7 files changed, 77 insertions, 40 deletions
@@ -98,8 +98,8 @@ Statistics fps frames per second tris number of triangles drawn quads number of quads drawn - tx network upstream traffic, in kb - rx network downstream traffic, in kb + tx network upstream traffic, in kilobyte + rx network downstream traffic, in kilobyte The fps counter will not show values above 9999. @@ -1,12 +1,16 @@ TODO +(ok) done +(--) postponed + milestone 1: console text color and wrapping + keyboard binds + entity axis interpolation - camera axis interpolation + camera axis interpolation (--) camera tracking mode camera frustum clip - keyboard binds milestone 2: server-client event system, hit-once lightweight entities @@ -18,8 +22,8 @@ filesystem: write handlers for zip model: - split map loader from model support map classes (e.g. func_rotate), requires class VertexData + split map loader from model, load vertices into VertexData engine flare key core: @@ -29,7 +33,8 @@ core: parse command line options (ok) execute command line options (ok) globe entity (ok) - execute config files + + execute config files (ok, autoexec.cfg still missing) game module loading/unloading network: @@ -44,6 +49,7 @@ network: fix lag protocol version in handshake detect and disconnect clients behaving badly + client: input handler switching (ok) console chars (ok) @@ -72,4 +78,3 @@ win32 port: screenshots are broken (ok) directory creation - diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs Binary files differindex aff14ba..6bf305e 100644 --- a/osirion.kdevelop.pcs +++ b/osirion.kdevelop.pcs diff --git a/osirion.kdevses b/osirion.kdevses index 1c4a484..97be539 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,22 +1,19 @@ <?xml version = '1.0' encoding = 'UTF-8'?> <!DOCTYPE KDevPrjSession> <KDevPrjSession> - <DocsAndViews NumberOfDocuments="5" > - <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/camera.cc" > - <View0 Encoding="" line="203" Type="Source" /> + <DocsAndViews NumberOfDocuments="4" > + <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/console.cc" > + <View0 Encoding="" line="193" Type="Source" /> </Doc0> - <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/render.cc" > - <View0 Encoding="" line="79" Type="Source" /> + <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" > + <View0 Encoding="" line="149" Type="Source" /> </Doc1> - <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/draw.cc" > - <View0 Encoding="" line="517" Type="Source" /> + <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/chat.cc" > + <View0 Encoding="" line="94" Type="Source" /> </Doc2> - <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/game/ship.cc" > - <View0 Encoding="" line="99" Type="Source" /> + <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/README" > + <View0 Encoding="" line="101" Type="Source" /> </Doc3> - <Doc4 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameinterface.cc" > - <View0 Encoding="" line="162" Type="Source" /> - </Doc4> </DocsAndViews> <pluginList> <kdevdebugger> 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); } } diff --git a/src/client/console.cc b/src/client/console.cc index 9e2a782..3331792 100644 --- a/src/client/console.cc +++ b/src/client/console.cc @@ -148,13 +148,15 @@ void draw() console_scroll = text.size(); gl::enable(GL_TEXTURE_2D); + std::deque<std::string>::reverse_iterator rit = text.rbegin(); + size_t width = (size_t) (video::width / CHARWIDTH) -2; float bottom = video::height*con_height-2*CHARHEIGHT-8; float y = bottom+console_scroll*CHARHEIGHT; while (y > 0 && rit < text.rend()) { if (y <= bottom) { std::string line(*rit); - + if (line[0] == '?') gl::color(0.7f,0.7f,0.7f, 1.0f); else if (line[0] == '*') @@ -164,21 +166,40 @@ void draw() else gl::color(1.0f,1.0f,1.0f, 1.0f); line.erase(0,2); + + std::deque<std::string> lines; + + while (line.size() > width) { + lines.push_back(line.substr(0, width)); + line.erase(0, width); + } + if (line.size()) + lines.push_back(line); + - draw_text(CHARWIDTH, y, line); + std::deque<std::string>::reverse_iterator lrit; + for (lrit = lines.rbegin(); (lrit != lines.rend()) && (y > 0); ++lrit) { + draw_text(CHARWIDTH, y, (*lrit)); + y -= CHARHEIGHT; + } + } else { + y -= CHARHEIGHT; } - y -= CHARHEIGHT; ++rit; } // draw the console input + size_t draw_pos = 0; + while (input_pos - draw_pos > width) + draw_pos += 2; + gl::color(0.0f, 1.0f, 0.0f, 1.0f); - draw_text(CHARWIDTH, video::height*con_height - CHARHEIGHT - 4, (*history_pos)); + draw_text(CHARWIDTH, video::height*con_height - CHARHEIGHT - 4, (*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+1), video::height*con_height - CHARHEIGHT - 4 , cursor); + draw_text(CHARWIDTH*(input_pos-draw_pos+1), video::height*con_height - CHARHEIGHT - 4 , cursor); } } diff --git a/src/client/view.cc b/src/client/view.cc index 3524403..3576b90 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -155,39 +155,47 @@ void draw_status() } stats << "tx "<< std::setw(5) << (core::Stats::network_bytes_sent >> 10) << "\n"; stats << "rx "<< std::setw(5) << (core::Stats::network_bytes_received >> 10) << "\n"; - draw_text(video::width-CHARWIDTH*12, 4, stats); + draw_text(video::width-CHARWIDTH*12, video::height - CHARHEIGHT*10, stats); } - /* - // print the version number in the upper right corner - gl::color(0.0f, 1.0f, 0.0f, 1.0f); - std::string version("ver. "); - version.append(core::version()); - draw_text(video::width-(version.size()+1)*CHARWIDTH, 4, version); - */ - // draw notifications gl::color(1.0f, 1.0f, 1.0f, 1.0f); + size_t width = (size_t) (video::width / CHARWIDTH) -2; size_t n = console::notify_pos % MAXNOTIFYLINES; int h = 4 + CHARHEIGHT; for (size_t l = 0; l < MAXNOTIFYLINES; l++) { if (console::notify_text[n].size() > 2 && console::notify_time[n] + 4 > core::application()->time()) { - if (console::notify_text[n][0] == '?') + std::string line(console::notify_text[n]); + + if (line[0] == '?') gl::color(0.7f,0.7f,0.7f, 1.0f); - else if (console::notify_text[n][0] == '*') + else if (line[0] == '*') gl::color(1.0f,1.0f,0.0f, 1.0f); - else if (console::notify_text[n][0] == '!') + else if (line[0] == '!') gl::color(1.0f,0.0f,0.0f, 1.0f); else gl::color(1.0f,1.0f,1.0f, 1.0f); - draw_text(CHARWIDTH, h, console::notify_text[n].substr(2)); - h += CHARHEIGHT; + line.erase(0,2); + + std::deque<std::string> lines; + + while (line.size() > width) { + draw_text(CHARWIDTH, h, line.substr(0, width)); + line.erase(0, width); + h += CHARHEIGHT; + } + if (line.size()) { + draw_text(CHARWIDTH, h, line); + h += CHARHEIGHT; + } } n = (n+1) % MAXNOTIFYLINES; } // draw a basic HUD if (core::localcontrol()) { + gl::color(1.0f,1.0f,1.0f, 1.0f); + status.str(""); status << "thrust " << std::setfill(' ') << std::setw(5) << std::fixed << std::setprecision(2) << core::localcontrol()->thrust() << " "; |