Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/view.cc')
-rw-r--r--src/client/view.cc60
1 files changed, 36 insertions, 24 deletions
diff --git a/src/client/view.cc b/src/client/view.cc
index 3576b90..7d11df3 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -142,7 +142,7 @@ void draw_status()
int seconds = (int) floorf( core::game()->clientframetime() - (float) minutes* 60.0f);
status << "time " << std::setfill('0') << std::setw(2) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds;
- draw_text(CHARWIDTH, 4, status);
+ Text::draw(4, 4, status);
}
// print stats if desired
@@ -155,14 +155,37 @@ 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, video::height - CHARHEIGHT*10, stats);
+ Text::draw(video::width-Text::fontwidth()*12, video::height - Text::fontheight()*8, stats);
}
+ // 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() << " ";
+
+ status << "speed " << std::setfill(' ') << std::setw(5) << std::fixed
+ << std::setprecision(2) << core::localcontrol()->speed();
+
+ Text::draw(4, video::height - Text::fontheight() -4, status);
+ }
+
+}
+
+void draw_notify()
+{
+ using namespace render;
+
+ if (console::visible())
+ return;
+
// draw notifications
gl::color(1.0f, 1.0f, 1.0f, 1.0f);
- size_t width = (size_t) (video::width / CHARWIDTH) -2;
+ size_t width = (size_t) ((video::width - 8) / Text::fontwidth());
size_t n = console::notify_pos % MAXNOTIFYLINES;
- int h = 4 + CHARHEIGHT;
+ float h = 4 + 2*Text::fontheight();
for (size_t l = 0; l < MAXNOTIFYLINES; l++) {
if (console::notify_text[n].size() > 2 && console::notify_time[n] + 4 > core::application()->time()) {
std::string line(console::notify_text[n]);
@@ -180,32 +203,17 @@ void draw_status()
std::deque<std::string> lines;
while (line.size() > width) {
- draw_text(CHARWIDTH, h, line.substr(0, width));
+ Text::draw(4, h, line.substr(0, width));
line.erase(0, width);
- h += CHARHEIGHT;
+ h += Text::fontheight();
}
if (line.size()) {
- draw_text(CHARWIDTH, h, line);
- h += CHARHEIGHT;
+ Text::draw(4, h, line);
+ h += Text::fontheight();
}
}
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() << " ";
-
- status << "speed " << std::setfill(' ') << std::setw(5) << std::fixed
- << std::setprecision(2) << core::localcontrol()->speed();
-
- draw_text(CHARWIDTH, video::height - CHARHEIGHT -4, status);
- }
-
}
void draw_cursor()
@@ -301,10 +309,14 @@ void frame(float seconds)
}
// draw text elements
- render::Textures::bind("bitmaps/conchars");
+ // FIXME width and height should be derived from texture size
+ Text::setfont("bitmaps/fonts/console", 12, 18);
console::draw();
+ draw_notify();
chat::draw();
+
+ Text::setfont("bitmaps/fonts/gui", 16, 24);
draw_status();
// draw the mouse cursor