From e55638d081e2e1ff6fbc06e0e8ac0381a04308e7 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 15 Sep 2010 21:29:18 +0000 Subject: updated comments, updated buy menu, info support for map window, added const to target selection --- src/client/Makefile.am | 8 ++--- src/client/buymenu.cc | 91 ++++++++++++++++++++++-------------------------- src/client/buymenu.h | 9 +++-- src/client/chat.cc | 30 +++++++++++++++- src/client/chat.h | 4 +++ src/client/client.h | 6 ++-- src/client/hud.cc | 2 +- src/client/infowidget.cc | 2 +- src/client/input.cc | 2 +- src/client/map.cc | 76 ++++++++++++++++++++++++++++++++-------- src/client/map.h | 20 ++++++++--- src/client/playerview.cc | 4 --- src/client/targets.cc | 26 +++++++------- src/client/targets.h | 10 +++--- src/client/trademenu.cc | 8 +++-- src/client/trademenu.h | 9 ++++- 16 files changed, 199 insertions(+), 108 deletions(-) (limited to 'src/client') diff --git a/src/client/Makefile.am b/src/client/Makefile.am index a90bfdb..3169525 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -8,16 +8,16 @@ noinst_LTLIBRARIES = libclient.la endif libclient_la_SOURCES = action.cc buymenu.cc chat.cc client.cc clientext.cc \ - entitymenu.cc hud.cc infowidget.cc input.cc joystick.cc key.cc keyboard.cc map.cc \ - notifications.cc playerview.cc soundext.cc targeticonbutton.cc targets.cc trademenu.cc \ - video.cc worldview.cc + entitymenu.cc hud.cc infowidget.cc input.cc inventorywindow.cc joystick.cc key.cc \ + keyboard.cc map.cc notifications.cc playerview.cc soundext.cc targeticonbutton.cc \ + targets.cc trademenu.cc video.cc worldview.cc libclient_la_CFLAGS = $(LIBSDL_CFLAGS) $(GL_CFLAGS) libclient_la_LDFLAGS = -avoid-version -no-undefined $(GL_LIBS) $(LIBSDL_LIBS) noinst_HEADERS = action.h chat.h client.h clientext.h hud.h entitymenu.h \ - input.h joystick.h key.h keyboard.h map.h notifications.h soundext.h \ + input.h inventorywindow.h joystick.h key.h keyboard.h map.h notifications.h soundext.h \ targets.h video.h infowidget.h playerview.h worldview.h trademenu.h buymenu.h \ targeticonbutton.h diff --git a/src/client/buymenu.cc b/src/client/buymenu.cc index d708511..c3878a8 100644 --- a/src/client/buymenu.cc +++ b/src/client/buymenu.cc @@ -16,50 +16,42 @@ namespace client BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Window(parent) { set_border(false); - set_background(true); + set_background(false); if (label) set_label(label); else set_label("buymenu"); - // model pane (left) - menu_modelpane = new ui::Window(this); - menu_modelpane->set_label("modelpane"); - menu_modelpane->set_background(true); - menu_modelpane->set_border(true); - - menu_modelview = new ui::ModelView(menu_modelpane); - menu_modelview->set_label("modelview"); - menu_modelview->set_background(false); - menu_modelview->set_border(false); - - menu_closebutton = new ui::Button(menu_modelpane, "Return", "view hide"); - - // text pane (right) - menu_textpane = new ui::Window(this); - menu_textpane->set_label("textpane"); - menu_textpane->set_background(true); - menu_textpane->set_border(true); + + menu_buywindow = new ui::Window(this); + menu_buywindow->set_label("buywindow"); + menu_buywindow->set_background(true); + menu_buywindow->set_border(true); - menu_namelabel = new ui::Label(menu_textpane); + menu_namelabel = new ui::Label(menu_buywindow); menu_namelabel->set_label("infolabel"); menu_namelabel->set_background(false); menu_namelabel->set_border(false); menu_namelabel->set_font(ui::root()->font_large()); menu_namelabel->set_alignment(ui::AlignCenter); - menu_scrollpane = new ui::ScrollPane(menu_textpane, menu_infotext); + menu_modelview = new ui::ModelView(menu_buywindow); + menu_modelview->set_label("modelview"); + menu_modelview->set_background(false); + menu_modelview->set_border(false); + + menu_scrollpane = new ui::ScrollPane(menu_buywindow, 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_closebutton = new ui::Button(menu_buywindow, "Return", "view hide"); + menu_buybutton = new ui::Button(menu_buywindow, "Buy"); menu_infotimestamp = 0; menu_inforecord = 0; - menu_modelpane->raise(); // DEBUG hide(); } @@ -89,7 +81,7 @@ void BuyMenu::set_item(std::string const & itemtype, std::string const & itemnam menu_namelabel->set_text(menu_inforecord->name()); menu_modelview->set_modelname(menu_inforecord->modelname()); - for (core::Info::Text::iterator it = menu_inforecord->text().begin(); it != menu_inforecord->text().end(); it++) { + for (core::Info::Text::const_iterator it = menu_inforecord->text().begin(); it != menu_inforecord->text().end(); it++) { menu_infotext.push_back((*it)); } menu_infotimestamp = menu_inforecord->timestamp(); @@ -103,34 +95,35 @@ void BuyMenu::set_item(std::string const & itemtype, std::string const & itemnam void BuyMenu::resize() { const float smallmargin = ui::UI::elementsize.height(); + const float fontmargin = menu_namelabel->font()->height(); + // this menu takes the entire screen set_size(parent()->size()); - - // reposition model pane (left) - menu_modelpane->set_size(ui::UI::elementsize.width() * 1.5f, height() - smallmargin * 4.0f); - menu_modelpane->set_location(smallmargin, smallmargin * 2.0f); - + + // resize the subwindow + menu_buywindow->set_size(width() - smallmargin * 2.0f, height()- smallmargin * 4.0f); + menu_buywindow->set_location(smallmargin, smallmargin * 2.0f); + + // resize label + menu_namelabel->set_size(menu_buywindow->width() - fontmargin * 2.0f, menu_namelabel->font()->height()); + menu_namelabel->set_location(fontmargin, fontmargin); + + // resize model view + menu_modelview->set_size(ui::UI::elementsize.width() * 1.5f, + menu_buywindow->height() - smallmargin * 2.0f - fontmargin * 3.0f); + menu_modelview->set_location(fontmargin, fontmargin * 3.0f); + + // resize infotext pane + menu_scrollpane->set_size(menu_buywindow->width() - ui::UI::elementsize.width() * 1.5f - fontmargin * 3.0f, + menu_buywindow->height() - smallmargin * 2.0f - fontmargin * 3.0f); + menu_scrollpane->set_location(ui::UI::elementsize.width() * 1.5f + fontmargin * 2.0f, fontmargin * 3.0f); + + // resize buttons + menu_buybutton->set_size(ui::UI::elementsize); + menu_buybutton->set_location(menu_buywindow->width() * 0.5f - ui::UI::elementsize.width() - smallmargin * 2.0f, menu_buywindow->height() - smallmargin * 1.5f); + menu_closebutton->set_size(ui::UI::elementsize); - menu_closebutton->set_location((menu_modelpane->width() - menu_closebutton->width()) * 0.5f, - menu_modelpane->height() - menu_closebutton->height() - ui::UI::elementsize.height() * 0.5f); - - menu_modelview->set_size(menu_modelpane->width() - 8, menu_modelpane->width() - 8); - menu_modelview->set_location(4, 4); - - // reposition text pane (right) - menu_textpane->set_size(width() - smallmargin * 3.0f - menu_modelpane->width(), height() - smallmargin * 4.0f); - menu_textpane->set_location(smallmargin * 2.0f + menu_modelpane->width(), smallmargin * 2.0f); - - menu_buybutton->set_size(ui::UI::elementsize); - menu_buybutton->set_location((menu_textpane->width() - menu_buybutton->width()) * 0.5f, - menu_textpane->height() - menu_buybutton->height() - ui::UI::elementsize.height() * 0.5f); - - menu_namelabel->set_size(menu_textpane->width(), menu_namelabel->font()->height() * 2.0f); - menu_namelabel->set_location(0, 4); - - menu_scrollpane->set_size(menu_textpane->width() - 8, menu_buybutton->top() - menu_namelabel->bottom() - 8); - menu_scrollpane->set_location(4, menu_namelabel->bottom() + 4); - + menu_closebutton->set_location(menu_buywindow->width() * 0.5f + smallmargin * 2.0f, menu_buywindow->height() - smallmargin * 1.5f); } void BuyMenu::draw() diff --git a/src/client/buymenu.h b/src/client/buymenu.h index f624ec3..016f473 100644 --- a/src/client/buymenu.h +++ b/src/client/buymenu.h @@ -39,22 +39,21 @@ protected: virtual bool on_keypress(const int key, const unsigned int modifier); private: - ui::Window *menu_modelpane; - ui::Window *menu_textpane; + ui::Window *menu_buywindow; ui::Label *menu_namelabel; ui::ScrollPane *menu_scrollpane; + ui::ModelView *menu_modelview; ui::Button *menu_closebutton; ui::Button *menu_buybutton; - ui::ModelView *menu_modelview; - std::string menu_itemtype; std::string menu_itemname; core::Info *menu_inforecord; ui::Text menu_infotext; - unsigned long menu_infotimestamp; + + unsigned long menu_infotimestamp; }; } diff --git a/src/client/chat.cc b/src/client/chat.cc index 5eb1922..c1fc78f 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -8,6 +8,7 @@ #include "client/chat.h" #include "client/client.h" #include "core/core.h" +#include "core/gameinterface.h" #include "sys/sys.h" #include "ui/ui.h" @@ -26,6 +27,12 @@ Chat::Chat(ui::Widget *parent) : ui::Window(parent) chat_scrollpane = new ui::ScrollPane(this, chat_log); chat_scrollpane->set_border(false); + chat_scrollpane->set_label("text"); + + chat_playerpane = new ui::ScrollPane(this, chat_players); + chat_playerpane->set_border(false); + chat_playerpane->set_label("players"); + chat_playerpane->set_alignment(ui::AlignLeft | ui::AlignTop); chat_input = new ui::InputBox(this); chat_input->set_border(false); @@ -46,6 +53,7 @@ Chat::~Chat() void Chat::clear() { + chat_players.clear(); chat_log.clear(); chat_input->clear(); } @@ -172,10 +180,24 @@ void Chat::event_draw() } if (chat_small) { + chat_playerpane->hide(); chat_scrollpane->hide(); } else { + chat_playerpane->show(); chat_scrollpane->show(); + + chat_players.clear(); + std::ostringstream ostr; + + ostr << "^B" << core::game()->players().size() << " " << aux::plural("player", core::game()->players().size()); + chat_players.push_back(ostr.str()); + + for (core::GameInterface::Players::iterator it = core::game()->players().begin(); it != core::game()->players().end(); it++) { + core::Player *player = (*it); + chat_players.push_back(player->name() + "^N"); + } } + Widget::event_draw(); } @@ -187,9 +209,15 @@ void Chat::resize() s[0] -= margin * 2; s[1] -= margin * 2; + // player names + chat_playerpane->set_size(ui::UI::elementsize.width() , s.height() - font()->height() * 2.5f); + chat_playerpane->set_location(s.width() - chat_playerpane->width() + 2.0f * margin, margin + font()->height()); + + // chat text + chat_scrollpane->set_size(s.width() - chat_playerpane->width() - margin, s.height() - font()->height() * 1.5f); chat_scrollpane->set_location(margin, margin); - chat_scrollpane->set_size(s.width(), s.height() - font()->height() *1.5f); + // input bar chat_input->set_location(margin, height() - font()->height() - margin); chat_input->set_size(s.width(), font()->height()); } diff --git a/src/client/chat.h b/src/client/chat.h index 41837c5..61f5bd1 100644 --- a/src/client/chat.h +++ b/src/client/chat.h @@ -48,6 +48,10 @@ private: ui::Text chat_log; ui::ScrollPane *chat_scrollpane; + + ui::Text chat_players; + ui::ScrollPane *chat_playerpane; + ui::InputBox *chat_input; typedef std::deque History; diff --git a/src/client/client.h b/src/client/client.h index fd762c6..2de731d 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -98,17 +98,17 @@ private: Client *client(); -inline ClientExt *ext_client(core::Entity *entity) +inline ClientExt *ext_client(const core::Entity *entity) { return static_cast(entity->extension(core::Extension::Client)); } -inline SoundExt *ext_sound(core::Entity *entity) +inline SoundExt *ext_sound(const core::Entity *entity) { return static_cast(entity->extension(core::Extension::Sound)); } -inline render::RenderExt *ext_render(core::Entity *entity) +inline render::RenderExt *ext_render(const core::Entity *entity) { return static_cast(entity->extension(core::Extension::Render)); } diff --git a/src/client/hud.cc b/src/client/hud.cc index c42431c..3a7601b 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -285,7 +285,7 @@ void HUD::draw() } */ - core::Entity *target = targets::current(); + const core::Entity *target = targets::current(); std::stringstream strdistance; if (target) { diff --git a/src/client/infowidget.cc b/src/client/infowidget.cc index cf7c684..3081b8d 100644 --- a/src/client/infowidget.cc +++ b/src/client/infowidget.cc @@ -44,7 +44,7 @@ DevInfoWidget::DevInfoWidget(ui::Widget *parent) : ui::Widget(parent) void DevInfoWidget::draw() { std::stringstream textstream; - core::Entity *target = targets::current(); + const core::Entity *target = targets::current(); float d = 0; textstream << "^Ncore ^B"; diff --git a/src/client/input.cc b/src/client/input.cc index e8f0725..16ba048 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -583,7 +583,7 @@ void key_released(Key *key) // note: mouse button can double as an action key if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover() && (key->waspressed() <= (input_mousedelay->value() / 1000.0f))) { // hovering target selected - targets::select_target(targets::hover()); + targets::set_target(targets::hover()); } if (key->action()) { diff --git a/src/client/map.cc b/src/client/map.cc index 7a6fedc..34dcb40 100644 --- a/src/client/map.cc +++ b/src/client/map.cc @@ -32,8 +32,13 @@ Map::Map(ui::Widget *parent) : ui::Window(parent) map_targetlabel->set_border(false); map_targetlabel->set_font(ui::root()->font_large()); map_targetlabel->set_alignment(ui::AlignCenter); + + map_scrollpane = new ui::ScrollPane(this, map_infotext); + map_scrollpane->set_background(false); + map_scrollpane->set_border(false); + map_scrollpane->set_alignment(ui::AlignTop); - map_target = 0; + set_target(0); map_hover = 0; hide(); } @@ -68,14 +73,29 @@ void Map::toggle() show(); } +void Map::resize() +{ + const float fontmargin = map_targetlabel->font()->height(); + + // resize label + map_targetlabel->set_size(width() - fontmargin * 2.0f, fontmargin); + map_targetlabel->set_location(fontmargin, fontmargin); + + // resize infotext pane + map_scrollpane->set_size(width() - ui::UI::elementsize.width() * 1.5f - fontmargin * 3.0f, + height() - ui::UI::elementsize.height() * 2.0f - fontmargin * 3.0f); + map_scrollpane->set_location(ui::UI::elementsize.width() * 1.5f + fontmargin * 2.0f, fontmargin * 3.0f); +} + void Map::draw() { - const float margin = font()->width() * 2.0f; - const float s = ui::UI::elementsize.width() * 2.0f; + const float fontmargin = map_targetlabel->font()->height(); + const float s = ui::UI::elementsize.width() * 1.5f; + const float blue = 0.8f; const float gridsize = 16; - core::Entity *entity; + const core::Entity *entity; const core::Entity *current_target = map_target; map_target = 0; @@ -84,8 +104,8 @@ void Map::draw() math::Vector2f v(global_location()); math::Vector2f l; - v[0] += margin; - v[1] += (height() - s - 2.0f * margin) * 0.5f; + v[0] += fontmargin; + v[1] += fontmargin + (height() - s) * 0.5f; map_hover = 0; gl::color(0, 0, blue); @@ -147,20 +167,20 @@ void Map::draw() if (draw_icon) { if (entity->type() == core::Entity::Globe) { if (entity->flag_is_set(core::Entity::Bright)) { - if (texture_current != texture_bright) { + if (texture_current != texture_bright) { gl::end(); texture_current = render::Textures::bind(texture_bright); gl::begin(gl::Quads); } } else { - if (texture_current != texture_globe) { + if (texture_current != texture_globe) { gl::end(); texture_current = render::Textures::bind(texture_globe); gl::begin(gl::Quads); } } } else { - if (texture_current != texture_entity) { + if (texture_current != texture_entity) { gl::end(); texture_current = render::Textures::bind(texture_entity); gl::begin(gl::Quads); @@ -224,13 +244,42 @@ void Map::draw() gl::end(); gl::disable(GL_TEXTURE_2D); + if (map_target != current_target) { + // this makes sure the map target exists + set_target(current_target); + + } else if (map_infotimestamp && map_inforecord && (map_infotimestamp != map_inforecord->timestamp())) { + set_target(map_target); + } +} + +void Map::set_target(const core::Entity *entity) { + + map_target = entity; + map_infotimestamp = 0; + map_inforecord = 0; + map_infotext.clear(); + if (map_target) { - map_targetlabel->set_size(width() - s - margin * 3.0f, map_targetlabel->font()->height() * 2.0f); - map_targetlabel->set_location(s + margin * 2.0f, 4); + // set title label to target name map_targetlabel->set_text(map_target->name()); map_targetlabel->show(); + + map_inforecord = map_target->info(); + + if (map_inforecord) { + for (core::Info::Text::const_iterator it = map_inforecord->text().begin(); it != map_inforecord->text().end(); it++) { + map_infotext.push_back((*it)); + } + map_infotimestamp = map_inforecord->timestamp(); + } else { + map_infotext.push_back("Information is not available"); + } + + map_scrollpane->show(); } else { map_targetlabel->hide(); + map_scrollpane->hide(); } } @@ -240,9 +289,8 @@ bool Map::on_keypress(const int key, const unsigned int modifier) if (hover()) { core::Entity *target = core::localplayer()->zone()->find_entity(hover()); if (targets::is_valid_map_target(target)) { - map_target = target; - targets::select_target(map_target); - //audio::play("ui/target"); + set_target(target); + targets::set_target(map_target); } } return true; diff --git a/src/client/map.h b/src/client/map.h index 1fc1547..e0d8a2d 100644 --- a/src/client/map.h +++ b/src/client/map.h @@ -7,9 +7,11 @@ #ifndef __INCLUDED_CLIENT_MAP_H__ #define __INCLUDED_CLIENT_MAP_H__ -#include "ui/window.h" -#include "ui/label.h" #include "core/entity.h" +#include "core/info.h" +#include "ui/label.h" +#include "ui/scrollpane.h" +#include "ui/window.h" namespace client { @@ -24,6 +26,9 @@ public: return map_hover; } + /// set the map target + void set_target(const core::Entity *entity); + /// toggle the map window void toggle(); @@ -37,12 +42,19 @@ public: virtual bool on_keypress(const int key, const unsigned int modifier); protected: + virtual void resize(); + virtual void draw(); + ui::Label *map_targetlabel; + ui::ScrollPane *map_scrollpane; + unsigned int map_hover; + const core::Entity *map_target; - core::Entity *map_target; - ui::Label *map_targetlabel; + const core::Info *map_inforecord; + unsigned long map_infotimestamp; + ui::Text map_infotext; }; diff --git a/src/client/playerview.cc b/src/client/playerview.cc index 7ec8031..578e97f 100644 --- a/src/client/playerview.cc +++ b/src/client/playerview.cc @@ -146,7 +146,6 @@ void PlayerView::show_menu(const std::string & args) void PlayerView::resize() { - //const float largemargin = ui::UI::elementsize.width() * 0.25; const float smallmargin = ui::UI::elementsize.height(); set_size(parent()->size()); @@ -166,9 +165,6 @@ void PlayerView::resize() view_notify->set_geometry(view_map->location(), view_map->size()); // reposition labels - //label_viewname->set_size(ui::UI::elementsize.width() * 1.5f, ui::UI::elementsize.height()); - //label_viewname->set_location(smallmargin, smallmargin * 0.5f); - label_viewname->set_size(ui::UI::elementsize.width() * 1.5f, ui::UI::elementsize.height()); label_viewname->set_location(width() - label_viewname->width() - smallmargin, height() - label_viewname->height() - smallmargin * 0.5f); } diff --git a/src/client/targets.cc b/src/client/targets.cc index cc7f29f..46643bb 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -38,9 +38,9 @@ const float TARGETBOXRADIUS = 0.025f; unsigned int current_target_id = 0; unsigned int current_hover = 0; -core::Entity *current_target = 0; +const core::Entity *current_target = 0; -bool is_valid_hud_target(core::Entity *entity) +bool is_valid_hud_target(const core::Entity *entity) { if (entity->serverside()) { return false; @@ -53,7 +53,7 @@ bool is_valid_hud_target(core::Entity *entity) } } -bool is_valid_map_target(core::Entity *entity) +bool is_valid_map_target(const core::Entity *entity) { if (entity->serverside()) { return false; @@ -68,7 +68,7 @@ bool is_valid_map_target(core::Entity *entity) } } -core::Entity* current() +const core::Entity* current() { return current_target; } @@ -83,7 +83,7 @@ unsigned int hover() return current_hover; } -void select_target(core::Entity *entity) +void set_target(const core::Entity *entity) { current_target = entity; if (entity) { @@ -94,7 +94,7 @@ void select_target(core::Entity *entity) } } -void select_target(unsigned int id) +void set_target(unsigned int id) { if (!core::localcontrol()) return; @@ -105,7 +105,7 @@ void select_target(unsigned int id) core::Entity *entity = zone->find_entity(id); if (entity && is_valid_hud_target(entity)) - select_target(entity); + set_target(entity); } void func_target_next(std::string const &args) @@ -154,7 +154,7 @@ void func_target_next(std::string const &args) } if (it != zone->content().end()) { - select_target((*it)); + set_target((*it)); } else { current_target = 0; current_target_id = 0; @@ -206,7 +206,7 @@ void func_target_prev(std::string const &args) } if (rit != zone->content().rend()) { - select_target((*rit)); + set_target((*rit)); } else { current_target = 0; current_target_id = 0; @@ -225,12 +225,12 @@ void func_target_center(std::string const &args) return; // this is essentialy the hover algorithm with the cursor in the center - core::Entity *new_target = 0; + const core::Entity *new_target = 0; math::Vector3f center = render::Camera::eye() + render::Camera::axis().forward() * (render::FRUSTUMFRONT + 0.001); float smallest_d = -1; - for (core::Zone::Content::iterator it = core::localcontrol()->zone()->content().begin(); it != core::localcontrol()->zone()->content().end(); it++) { - core::Entity *entity = (*it); + for (core::Zone::Content::const_iterator it = core::localcontrol()->zone()->content().begin(); it != core::localcontrol()->zone()->content().end(); it++) { + const core::Entity *entity = (*it); math::Vector3f v(entity->location() - render::Camera::eye()); v.normalize(); @@ -249,7 +249,7 @@ void func_target_center(std::string const &args) } if (new_target) - select_target(new_target); + set_target(new_target); } void reset() diff --git a/src/client/targets.h b/src/client/targets.h index 5a3a655..e66ff97 100644 --- a/src/client/targets.h +++ b/src/client/targets.h @@ -25,16 +25,16 @@ void shutdown(); void reset(); /// return true if the entity is a legal hud target -bool is_valid_hud_target(core::Entity *entity); +bool is_valid_hud_target(const core::Entity *entity); /// return true if the entity is a legal map target -bool is_valid_map_target(core::Entity *entity); +bool is_valid_map_target(const core::Entity *entity); /// render targets and sounds void frame(); /// currently selected target, 0 if there is none -core::Entity *current(); +const core::Entity *current(); /// id of the currently selected target, 0 if there is none unsigned int current_id(); @@ -43,10 +43,10 @@ unsigned int current_id(); unsigned int hover(); /// target a specific entity -void select_target(unsigned int id); +void set_target(unsigned int id); /// target a specific entity -void select_target(core::Entity *entity); +void set_target(const core::Entity *entity); } diff --git a/src/client/trademenu.cc b/src/client/trademenu.cc index dcab2f1..c60791f 100644 --- a/src/client/trademenu.cc +++ b/src/client/trademenu.cc @@ -12,15 +12,19 @@ namespace client { -TradeMenu::TradeMenu(ui::Widget *parent, const char * label) : ui::Window(parent) +TradeMenu::TradeMenu(ui::Window *parent, const char * label) : ui::Window(parent) { set_border(false); - set_background(false); + set_background(false); if (label) set_label(label); else set_label("trademenu"); + menu_tradewindow = new ui::Window(this); + menu_tradewindow->set_label("tradewindow"); + menu_tradewindow->set_border(true); + hide(); } diff --git a/src/client/trademenu.h b/src/client/trademenu.h index baf3544..03b5077 100644 --- a/src/client/trademenu.h +++ b/src/client/trademenu.h @@ -19,8 +19,15 @@ class TradeMenu : public ui::Window { public: /// create a new menu - TradeMenu(ui::Widget *parent, const char * label = 0); + TradeMenu(ui::Window *parent, const char * label = 0); ~TradeMenu(); + +protected: + /// resize event + virtual void resize(); + +private: + ui::Window *menu_tradewindow; }; } -- cgit v1.2.3