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>2009-05-30 09:55:13 +0000
committerStijn Buys <ingar@osirion.org>2009-05-30 09:55:13 +0000
commita0cb9f0208b5ecdffdd9328d5305ed99e7cbd5e6 (patch)
tree118afd7b47facfa0952838e1ed355f057da7c4fd /src
parent5f024a1e9293a2644a4a87039ab3e318bba0f42c (diff)
HUD keypress event
Diffstat (limited to 'src')
-rw-r--r--src/client/hud.cc16
-rw-r--r--src/client/hud.h3
-rw-r--r--src/client/playerview.cc5
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()