diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/hud.cc | 16 | ||||
-rw-r--r-- | src/client/hud.h | 3 | ||||
-rw-r--r-- | src/client/playerview.cc | 5 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/client/hud.cc b/src/client/hud.cc index 991f02b..ca7db56 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -11,6 +11,7 @@ #include "client/targets.h" #include "render/render.h" #include "render/renderext.h" +#include "ui/ui.h" namespace client { @@ -212,6 +213,21 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) } } +bool HUD::on_keypress(const int key, const unsigned int modifier) +{ + switch( key ) { + case SDLK_ESCAPE: + if (targets::current()) { + targets::reset(); + } else { + ui::root()->show_menu("game"); + } + return true; + } + + return false; +} + void HUD::draw() { using namespace render; diff --git a/src/client/hud.h b/src/client/hud.h index 23fa544..d89450f 100644 --- a/src/client/hud.h +++ b/src/client/hud.h @@ -33,6 +33,9 @@ protected: /// rearrange child widgets virtual void resize(); + /// receive keyboard events + virtual bool on_keypress(const int key, const unsigned int modifier); + private: void draw_offscreen_target(core::Entity *entity, bool is_active_target); diff --git a/src/client/playerview.cc b/src/client/playerview.cc index c7e50ff..ca1d47e 100644 --- a/src/client/playerview.cc +++ b/src/client/playerview.cc @@ -33,8 +33,9 @@ PlayerView::PlayerView(ui::Widget *parent) : ui::Widget(parent) view_entitymenu = new EntityMenu(this); view_buymenu = new BuyMenu(this); - view_hud->lower(); - view_entitymenu->raise(); + //view_hud->set_focus(); + //view_hud->raise(); + //view_entitymenu->raise(); } PlayerView::~PlayerView() |