summaryrefslogtreecommitdiff
path: root/src/gui/charselectdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/charselectdialog.cpp')
-rw-r--r--src/gui/charselectdialog.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 43537ca3..4f3619ae 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -34,6 +34,7 @@
#include "gui/confirmdialog.h"
#include "gui/okdialog.h"
#include "gui/playerbox.h"
+#include "gui/sdlinput.h"
#include "gui/unregisterdialog.h"
#include "game.h"
@@ -162,6 +163,8 @@ CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo,
reflowLayout();
+ addKeyListener(this);
+
center();
mCharEntries[0]->requestFocus();
setVisible(true);
@@ -217,6 +220,16 @@ void CharSelectDialog::action(const gcn::ActionEvent &event)
}
}
+void CharSelectDialog::keyPressed(gcn::KeyEvent &keyEvent)
+{
+ gcn::Key key = keyEvent.getKey();
+
+ if (key.getValue() == Key::ESCAPE)
+ {
+ action(gcn::ActionEvent(NULL, mSwitchLoginButton->getActionEventId()));
+ }
+}
+
void CharSelectDialog::attemptCharDelete()
{
mCharHandler->deleteCharacter(mCharInfo->getPos(), mCharInfo->getEntry());