From 0b7e752bd177c90a05ca752fa31810f9e34c432c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 19 Apr 2012 23:48:29 +0300 Subject: Dehardcode keys in gui widgets. Add new tab with keys settings in input settings tab. --- src/gui/worldselectdialog.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/gui/worldselectdialog.cpp') diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index 26fd19208..d1b97c82f 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -23,6 +23,8 @@ #include "gui/worldselectdialog.h" #include "client.h" +#include "keydata.h" +#include "keyevent.h" #include "gui/sdlinput.h" @@ -138,14 +140,15 @@ void WorldSelectDialog::action(const gcn::ActionEvent &event) void WorldSelectDialog::keyPressed(gcn::KeyEvent &keyEvent) { - gcn::Key key = keyEvent.getKey(); + int actionId = static_cast(&keyEvent)->getActionId(); - if (key.getValue() == Key::ESCAPE) + if (actionId == Input::KEY_GUI_CANCEL) { action(gcn::ActionEvent(nullptr, mChangeLoginButton->getActionEventId())); } - else if (key.getValue() == Key::ENTER) + else if (actionId == Input::KEY_GUI_SELECT + || actionId == Input::KEY_GUI_SELECT2) { action(gcn::ActionEvent(nullptr, mChooseWorld->getActionEventId())); } -- cgit v1.2.3-70-g09d2