diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-09 11:43:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-09 11:43:28 +0000 |
commit | 9d39702824e8fae5127e09fb5a05b521b48cd028 (patch) | |
tree | a56fdfc6e85a2405461be22bc80e43b33c8b8b48 /src/client | |
parent | 6cd1a38f1d3a0a45846d63a75475400372af1277 (diff) |
docking menus
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/client.cc | 10 | ||||
-rw-r--r-- | src/client/input.cc | 8 | ||||
-rw-r--r-- | src/client/view.cc | 18 |
3 files changed, 32 insertions, 4 deletions
diff --git a/src/client/client.cc b/src/client/client.cc index a83beb7..617b569 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -187,11 +187,21 @@ void Client::frame(unsigned long timestamp) // show the join menu when player does not control an entity } else if (core::game()->time() && !core::localcontrol()) { ui::root()->show_menu("join"); + + // show the view menu when docked + } else if (core::localcontrol() && core::localplayer()->view()) { + ui::root()->show_menuview("main"); } + } else { if (core::localcontrol()) { + // hide join menu if (ui::root()->active()->label().compare("join") == 0) { ui::root()->hide_menu(); + + // hide view menu + } else if (!core::localplayer()->view() && (ui::root()->active()->label().compare("view") == 0)) { + ui::root()->hide_menu(); } } } diff --git a/src/client/input.cc b/src/client/input.cc index 9cb48a1..dcddea3 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -133,7 +133,7 @@ void func_ui_control(std::string const &args) void func_view_next(std::string const &args) { - if (core::application()->connected() && core::localcontrol()) { + if (!core::localplayer()->view() && core::application()->connected() && core::localcontrol()) { render::Camera::view_next(); local_roll = 0; local_pitch = 0; @@ -144,7 +144,7 @@ void func_view_next(std::string const &args) void func_view_prev(std::string const &args) { - if (core::application()->connected() && core::localcontrol()) { + if (!core::localplayer()->view() && core::application()->connected() && core::localcontrol()) { render::Camera::view_previous(); local_roll = 0; local_pitch = 0; @@ -511,7 +511,7 @@ void key_pressed(Key *key) if (ui::root()->input_key(true, Keyboard::translate_keysym(key->sym(), keyboard_modifiers), keyboard_modifiers)) { return; - } else if (core::application()->connected() && core::localcontrol()) { + } else if (!core::localplayer()->view() && core::application()->connected() && core::localcontrol()) { char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0]; if (c == '@') { @@ -529,7 +529,7 @@ void key_pressed(Key *key) } else if (core::application()->connected()) { char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0]; - if (c && c != '+') { + if (c && c != '+' && c != '@') { // normal bind core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << "\n"; } diff --git a/src/client/view.cc b/src/client/view.cc index 9eb9c33..304d2a5 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -455,6 +455,15 @@ void draw_entity_target(core::Entity *entity, bool is_active_target) glVertex3f(cx, cy-r+2, 0); render::gl::end(); + if ((entity->flags() & core::Entity::Dockable) == core::Entity::Dockable) { + render::gl::begin(render::gl::LineLoop); + glVertex3f(cx+ (r*0.25f), cy+2, 0); + glVertex3f(cx, cy+(r*0.25f)+2, 0); + glVertex3f(cx-(r*0.25f), cy+2, 0); + glVertex3f(cx, cy-(r*0.25f)+2, 0); + render::gl::end(); + } + if (entity == core::localplayer()->mission_target()) { render::gl::color(1, 0.5f, 1, 1); // FIXME mission color } else if (entity->type() == core::Entity::Controlable) { @@ -471,6 +480,15 @@ void draw_entity_target(core::Entity *entity, bool is_active_target) glVertex3f(cx, cy-r, 0); render::gl::end(); + if ((entity->flags() & core::Entity::Dockable) == core::Entity::Dockable) { + render::gl::begin(render::gl::LineLoop); + glVertex3f(cx+(r*0.25f), cy, 0); + glVertex3f(cx, cy+(r*0.25f), 0); + glVertex3f(cx-(r*0.25f), cy, 0); + glVertex3f(cx, cy-(r*0.25f), 0); + render::gl::end(); + } + render::gl::enable(GL_TEXTURE_2D); if (is_active_target) { |