diff options
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 573060d30..657e39bea 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -109,8 +109,35 @@ EmuThread& GRenderWindow::GetEmuThread() | |||
| 109 | return emu_thread; | 109 | return emu_thread; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | static const std::pair<int, HID_User::PadState> default_key_map[] = { | ||
| 113 | { Qt::Key_A, HID_User::PAD_A }, | ||
| 114 | { Qt::Key_B, HID_User::PAD_B }, | ||
| 115 | { Qt::Key_Backslash, HID_User::PAD_SELECT }, | ||
| 116 | { Qt::Key_Enter, HID_User::PAD_START }, | ||
| 117 | { Qt::Key_Right, HID_User::PAD_RIGHT }, | ||
| 118 | { Qt::Key_Left, HID_User::PAD_LEFT }, | ||
| 119 | { Qt::Key_Up, HID_User::PAD_UP }, | ||
| 120 | { Qt::Key_Down, HID_User::PAD_DOWN }, | ||
| 121 | { Qt::Key_R, HID_User::PAD_R }, | ||
| 122 | { Qt::Key_L, HID_User::PAD_L }, | ||
| 123 | { Qt::Key_X, HID_User::PAD_X }, | ||
| 124 | { Qt::Key_Y, HID_User::PAD_Y }, | ||
| 125 | { Qt::Key_H, HID_User::PAD_CIRCLE_RIGHT }, | ||
| 126 | { Qt::Key_F, HID_User::PAD_CIRCLE_LEFT }, | ||
| 127 | { Qt::Key_T, HID_User::PAD_CIRCLE_UP }, | ||
| 128 | { Qt::Key_G, HID_User::PAD_CIRCLE_DOWN }, | ||
| 129 | }; | ||
| 130 | |||
| 112 | GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this) | 131 | GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this) |
| 113 | { | 132 | { |
| 133 | // Register a new ID for the default keyboard | ||
| 134 | keyboard_id = KeyMap::NewDeviceId(); | ||
| 135 | |||
| 136 | // Set default key mappings for keyboard | ||
| 137 | for (auto mapping : default_key_map) { | ||
| 138 | KeyMap::SetKeyMapping({mapping.first, keyboard_id}, mapping.second); | ||
| 139 | } | ||
| 140 | |||
| 114 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose | 141 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose |
| 115 | QGLFormat fmt; | 142 | QGLFormat fmt; |
| 116 | fmt.setProfile(QGLFormat::CoreProfile); | 143 | fmt.setProfile(QGLFormat::CoreProfile); |
| @@ -209,27 +236,13 @@ QByteArray GRenderWindow::saveGeometry() | |||
| 209 | 236 | ||
| 210 | void GRenderWindow::keyPressEvent(QKeyEvent* event) | 237 | void GRenderWindow::keyPressEvent(QKeyEvent* event) |
| 211 | { | 238 | { |
| 212 | /* | 239 | EmuWindow::KeyPressed({event->key(), keyboard_id}); |
| 213 | bool key_processed = false; | 240 | HID_User::PadUpdateComplete(); |
| 214 | for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel) | ||
| 215 | if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::PRESSED)) | ||
| 216 | key_processed = true; | ||
| 217 | |||
| 218 | if (!key_processed) | ||
| 219 | QWidget::keyPressEvent(event); | ||
| 220 | */ | ||
| 221 | } | 241 | } |
| 222 | 242 | ||
| 223 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) | 243 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) |
| 224 | { | 244 | { |
| 225 | /* | 245 | EmuWindow::KeyReleased({event->key(), keyboard_id}); |
| 226 | bool key_processed = false; | 246 | HID_User::PadUpdateComplete(); |
| 227 | for (unsigned int channel = 0; channel < 4 && controller_interface(); ++channel) | ||
| 228 | if (controller_interface()->SetControllerStatus(channel, event->key(), input_common::GCController::RELEASED)) | ||
| 229 | key_processed = true; | ||
| 230 | |||
| 231 | if (!key_processed) | ||
| 232 | QWidget::keyPressEvent(event); | ||
| 233 | */ | ||
| 234 | } | 247 | } |
| 235 | 248 | ||