diff options
author | Stijn Buys <ingar@osirion.org> | 2009-06-07 18:13:15 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-06-07 18:13:15 +0000 |
commit | f33257521bf80dcef8575c4fc3ddaf4a40ff588a (patch) | |
tree | 5e3a112e814478ba3ab624e0867761654a5ea0a4 /src/client | |
parent | 5b94df1df2707b36401d91d80b92d0e4cdfd2277 (diff) |
fixed a few widget order problems, changed map targetting behaviour
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/buymenu.cc | 8 | ||||
-rw-r--r-- | src/client/client.cc | 3 | ||||
-rw-r--r-- | src/client/map.cc | 22 | ||||
-rw-r--r-- | src/client/playerview.cc | 6 | ||||
-rw-r--r-- | src/client/targets.cc | 17 | ||||
-rw-r--r-- | src/client/targets.h | 5 |
6 files changed, 36 insertions, 25 deletions
diff --git a/src/client/buymenu.cc b/src/client/buymenu.cc index fecf4e0..4a4107b 100644 --- a/src/client/buymenu.cc +++ b/src/client/buymenu.cc @@ -29,13 +29,13 @@ BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Window(parent) menu_modelpane->set_background(true); menu_modelpane->set_border(true); - menu_closebutton = new ui::Button(menu_modelpane, "Close","view hide"); - menu_modelview = new ui::ModelView(menu_modelpane); menu_modelview->set_label("modelview"); menu_modelview->set_background(false); menu_modelview->set_border(true); + menu_closebutton = new ui::Button(menu_modelpane, "Close","view hide"); + // text pane (right) menu_textpane = new ui::Window(this); menu_textpane->set_label("textpane"); @@ -48,12 +48,14 @@ BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Window(parent) menu_namelabel->set_border(false); menu_namelabel->set_font(ui::root()->font_large()); menu_namelabel->set_alignment(ui::AlignCenter); - menu_buybutton = new ui::Button(menu_textpane, "Buy"); + menu_scrollpane = new ui::ScrollPane(menu_textpane, menu_infotext); menu_scrollpane->set_background(false); menu_scrollpane->set_border(false); menu_scrollpane->set_alignment(ui::AlignTop); + menu_buybutton = new ui::Button(menu_textpane, "Buy"); + menu_infotimestamp = 0; menu_inforecord = 0; diff --git a/src/client/client.cc b/src/client/client.cc index 47af682..1fa2796 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -426,6 +426,7 @@ void Client::func_ui_help() con_print << " ui help show this help" << std::endl; con_print << " ui debug toggle debug mode" << std::endl; con_print << " ui list list widgets" << std::endl; + con_print << " ui visible list visible widgets" << std::endl; con_print << " ui restart reload user interface files" << std::endl; } @@ -451,6 +452,8 @@ void Client::func_ui(std::string const &args) ui::UI::ui_debug = !ui::UI::ui_debug; } else if (command.compare("list") == 0) { ui::root()->list(); + } else if (command.compare("visible") == 0) { + ui::root()->list_visible(); } else if (command.compare("restart") == 0) { ui::root()->load_menus(); ui::root()->load_settings(); diff --git a/src/client/map.cc b/src/client/map.cc index 805957c..a2a353a 100644 --- a/src/client/map.cc +++ b/src/client/map.cc @@ -18,21 +18,6 @@ namespace client { -bool is_valid_map_target(core::Entity *entity) -{ - if (entity->serverside()) { - return false; - } else if (entity == core::localcontrol()) { - return false; - } else if (entity->flag_is_set(core::Entity::ShowOnMap)) { - return true; - } else if (entity == core::localplayer()->mission_target()) { - return true; - } else { - return false; - } -} - Map::Map(ui::Widget *parent) : ui::Window(parent) { set_label("map"); @@ -141,7 +126,7 @@ void Map::draw() bool draw_icon = false; l.assign(v); - if (is_valid_map_target(entity)) { + if (targets::is_valid_map_target(entity)) { draw_icon = true; l.x -= s / scale * entity->location().y; l.y -= s / scale * entity->location().x; @@ -253,9 +238,10 @@ bool Map::on_keypress(const int key, const unsigned int modifier) if (key == 512 + SDL_BUTTON_LEFT) { if (hover()) { core::Entity *target = core::localplayer()->zone()->find_entity(hover()); - if (is_valid_map_target(target)) { + if (targets::is_valid_map_target(target)) { map_target = target; - audio::play("ui/target"); + targets::select_target(map_target); + //audio::play("ui/target"); } } return true; diff --git a/src/client/playerview.cc b/src/client/playerview.cc index a37cd73..e75cd47 100644 --- a/src/client/playerview.cc +++ b/src/client/playerview.cc @@ -21,15 +21,17 @@ PlayerView::PlayerView(ui::Widget *parent) : ui::Widget(parent) view_lastentity = 0; + view_notify = new Notifications(this); + view_hud = new HUD(this); + label_viewname = new ui::Label(this); + label_viewname->set_label("viewnamelabel"); label_viewname->set_alignment(ui::AlignCenter); label_viewname->set_background(true); label_viewname->set_font(ui::root()->font_large()); - view_notify = new Notifications(this); view_chat = new Chat(this); view_map = new Map(this); - view_hud = new HUD(this); view_entitymenu = new EntityMenu(this); view_buymenu = new BuyMenu(this); diff --git a/src/client/targets.cc b/src/client/targets.cc index 0bec6c5..c634557 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -53,6 +53,21 @@ bool is_valid_hud_target(core::Entity *entity) } } +bool is_valid_map_target(core::Entity *entity) +{ + if (entity->serverside()) { + return false; + } else if (entity == core::localcontrol()) { + return false; + } else if (entity->flag_is_set(core::Entity::ShowOnMap)) { + return true; + } else if (entity == core::localplayer()->mission_target()) { + return true; + } else { + return false; + } +} + core::Entity* current() { return current_target; @@ -358,7 +373,7 @@ void frame() } // find the current target - if (!core::localplayer()->view() && core::localcontrol() && is_valid_hud_target(entity)) { + if (!core::localplayer()->view() && core::localcontrol() && (is_valid_hud_target(entity) || is_valid_map_target(entity))) { if (entity->id() == current_target_id) { current_target = entity; diff --git a/src/client/targets.h b/src/client/targets.h index 67ee742..d421300 100644 --- a/src/client/targets.h +++ b/src/client/targets.h @@ -22,9 +22,12 @@ void shutdown(); void reset(); -/// return true if the entity is a legal target +/// return true if the entity is a legal hud target bool is_valid_hud_target(core::Entity *entity); +/// return true if the entity is a legal map target +bool is_valid_map_target(core::Entity *entity); + /// render targets and sounds void frame(); |