Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-08-08 15:02:19 +0000
committerStijn Buys <ingar@osirion.org>2008-08-08 15:02:19 +0000
commit194b8b358fc8603da2c102dcf46f20b23a31aea4 (patch)
treedc2c0894ebfbe489dd14012fad9faef2622f972d /src
parent0b3a444048953dc0a6642ffc10062c196c79d56a (diff)
documentation updates, new default binds, HUD updates
Diffstat (limited to 'src')
-rw-r--r--src/client/keyboard.cc9
-rw-r--r--src/client/view.cc81
2 files changed, 67 insertions, 23 deletions
diff --git a/src/client/keyboard.cc b/src/client/keyboard.cc
index 57d99b3..af7f2ed 100644
--- a/src/client/keyboard.cc
+++ b/src/client/keyboard.cc
@@ -127,7 +127,7 @@ Keyboard::Keyboard()
key->assign(Key::Shift, "view_prev");
add_key("w", SDLK_w, 'w');
- add_key("x", SDLK_x, 'x');
+ add_key("x", SDLK_x, 'x', "target_center");
add_key("y", SDLK_y, 'y');
add_key("z", SDLK_z, 'z');
@@ -165,7 +165,10 @@ Keyboard::Keyboard()
add_key("f1", SDLK_F1);
add_key("f2", SDLK_F2);
add_key("f3", SDLK_F3);
- add_key("f4", SDLK_F4);
+ key = add_key("f4", SDLK_F4);
+#ifdef _WIN32
+ key->assign(Key::Alt, "quit");
+#endif
add_key("f5", SDLK_F5);
add_key("f6", SDLK_F6);
add_key("f7", SDLK_F7);
@@ -215,7 +218,7 @@ Keyboard::Keyboard()
// joystick button aliases
add_key("joy0", 564);
- add_key("joy1", 565);
+ add_key("joy1", 565, 0, "target_center");
add_key("joy2", 566);
add_key("joy3", 567);
add_key("joy4", 568);
diff --git a/src/client/view.cc b/src/client/view.cc
index eef3920..e1e0820 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -31,7 +31,7 @@ namespace client
core::Cvar *draw_ui = 0;
core::Cvar *draw_stats = 0;
-core::Cvar *draw_location = 0;
+core::Cvar *draw_devinfo = 0;
core::Cvar *draw_keypress = 0;
core::Cvar *ui_pointercolor = 0;
@@ -53,8 +53,8 @@ void init()
draw_stats = core::Cvar::get("draw_stats", "0", core::Cvar::Archive);
draw_stats->set_info("[bool] draw network and render statistics");
- draw_location = core::Cvar::get("draw_location", "0", core::Cvar::Archive);
- draw_location->set_info("[bool] draw world location");
+ draw_devinfo = core::Cvar::get("draw_devinfo", "0", core::Cvar::Archive);
+ draw_devinfo->set_info("[bool] draw developer information");
draw_ui = core::Cvar::get("draw_ui", "1", core::Cvar::Archive);
draw_ui->set_info("[bool] draw the user interface");
@@ -161,16 +161,14 @@ void draw_status()
Text::draw(video::width-Text::fontwidth()*12-4, 4 + Text::fontheight()*2, stats);
}
+ // draw keypress
+ if (draw_keypress->value() && input::last_key_pressed()) {
+ Text::setcolor('F'); //set fancy color
+ Text::draw(video::width-4-Text::fontwidth()*6, video::height-Text::fontheight()-4, input::last_key_pressed()->name());
+ }
+
// draw a basic HUD
if (core::localcontrol()) {
- status.str("");
- status << "^Nthrust ^B" << std::setfill(' ') << std::setw(5) << std::fixed
- << std::setprecision(2) << core::localcontrol()->thrust() << " ";
-
- status << "^Nspeed ^B" << std::setfill(' ') << std::setw(5) << std::fixed
- << std::setprecision(2) << core::localcontrol()->speed();
-
- Text::draw(4, video::height - Text::fontheight()-4, status);
unsigned int state = core::localcontrol()->eventstate();
if (state) {
@@ -186,16 +184,19 @@ void draw_status()
statestr << "^FJumping...";
}
- Text::draw(4, video::height - Text::fontheight()*2-4, statestr);
+ Text::draw(4, video::height - Text::fontheight()*3-4, statestr);
}
- if (draw_location->value()) {
- std::stringstream location;
- location << std::fixed << std::setprecision(2)
+ if (draw_devinfo->value()) {
+ std::stringstream devinfo;
+ devinfo << std::fixed << std::setprecision(2)
<< "^Nx:^B" << core::localcontrol()->location().x << " "
<< "^Ny:^B" << core::localcontrol()->location().y << " "
<< "^Nz:^B" << core::localcontrol()->location().z << '\n';
- Text::draw(4, video::height - Text::fontheight()*3 -4, location);
+
+ devinfo << "^Nthurst:^B " << core::localcontrol()->thrust() << " "
+ << "^Nspeed:^B " << core::localcontrol()->speed() << '\n';
+ Text::draw(4, 4 + Text::fontheight(), devinfo);
}
float y = 1.0f;
@@ -216,12 +217,52 @@ void draw_status()
y = 3.0f;
}
+ Text::setcolor('N'); //set normal color
Text::draw(video::width-4-Text::fontwidth()*32, video::height-Text::fontheight()*y-4, core::localcontrol()->zone()->name());
- }
- if (draw_keypress->value() && input::last_key_pressed()) {
- Text::setcolor('F'); //set fancy color
- Text::draw(video::width-4-Text::fontwidth()*6, video::height-Text::fontheight()-4, input::last_key_pressed()->name());
+ Textures::bind("bitmaps/hud/thruster_base"); // 316 x 32 bitmap
+ gl::color(1, 1, 1, 1);
+ gl::begin(render::gl::Quads);
+
+ glTexCoord2f(0, 0);
+ gl::vertex(4, video::height - 4 - 32, 0);
+
+ glTexCoord2f(1, 0);
+ gl::vertex(4 + 316, video::height - 4 - 32, 0);
+
+ glTexCoord2f(1, 1);
+ gl::vertex(4 + 316, video::height - 4 , 0);
+
+ glTexCoord2f(0, 1);
+ gl::vertex(4, video::height - 4 , 0);
+
+ gl::end();
+
+ float u = core::localcontrol()->thrust();
+ if ( u > 0) {
+ Textures::bind("bitmaps/hud/thruster_indicator"); // 316 x 32 bitmap
+ gl::begin(render::gl::Quads);
+ glTexCoord2f(0, 0);
+ gl::vertex(4, video::height - 4 - 32, 0);
+
+ glTexCoord2f(u, 0);
+ gl::vertex(4.0f + u * 316.0f, video::height - 4 - 32, 0);
+
+ glTexCoord2f(u, 1);
+ gl::vertex(4.0f + u * 316.0f, video::height - 4 , 0);
+
+ glTexCoord2f(0, 1);
+ gl::vertex(4, video::height - 4 , 0);
+
+ gl::end();
+ }
+ Text::setfont("bitmaps/fonts/gui", 14, 24);
+ std::stringstream speedstr;
+ speedstr << "^B" << roundf(core::localcontrol()->speed() * 100.0f);
+ Text::draw( 316+4+10, video::height - 6 -16 - render::Text::fontwidth() /2, speedstr);
+
+ Text::setfont("bitmaps/fonts/gui", 12, 18);
+ Text::setcolor('N'); //set normal color
}
}