From 43f78b5d5aea18fb77a48bb4c490dc77d927e9f5 Mon Sep 17 00:00:00 2001 From: Zetro Date: Wed, 4 Sep 2013 22:38:45 +0200 Subject: [PATCH] Use key mappings in desktop Qt frontend --- Qt/mainwindow.cpp | 25 +++---------------------- Qt/mainwindow.h | 7 ------- Qt/mainwindow.ui | 12 ------------ 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 1564705e4d..b7fc188757 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -15,6 +15,7 @@ #include "Core/Config.h" #include "ConsoleListener.h" #include "base/display.h" +#include "base/NKCodeFromQt.h" #include "GPU/GPUInterface.h" #include "QtHost.h" @@ -35,8 +36,6 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); - controls = new Controls(this); - host = new QtHost(this); emugl = ui->widget; emugl->init(&input_state); @@ -89,19 +88,6 @@ void MainWindow::Update() { emugl->updateGL(); - for (int i = 0; i < controllistCount; i++) - { - if (pressedKeys.contains(controllist[i].key) || - input_state.pad_buttons_down & controllist[i].emu_id) - __CtrlButtonDown(controllist[i].psp_id); - else - __CtrlButtonUp(controllist[i].psp_id); - } - __CtrlSetAnalogX(clamp1(input_state.pad_lstick_x), 0); - __CtrlSetAnalogY(clamp1(input_state.pad_lstick_y), 0); - __CtrlSetAnalogX(clamp1(input_state.pad_rstick_x), 1); - __CtrlSetAnalogY(clamp1(input_state.pad_rstick_y), 1); - if (lastUIState != globalUIState) { lastUIState = globalUIState; UpdateMenus(); @@ -197,12 +183,12 @@ void MainWindow::keyPressEvent(QKeyEvent *e) return; } - pressedKeys.insert(e->key()); + NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(e->key())->second, KEY_DOWN)); } void MainWindow::keyReleaseEvent(QKeyEvent *e) { - pressedKeys.remove(e->key()); + NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(e->key())->second, KEY_UP)); } /* SLOTS */ @@ -452,11 +438,6 @@ void MainWindow::on_action_OptionsIgnoreIllegalReadsWrites_triggered() UpdateMenus(); } -void MainWindow::on_action_OptionsControls_triggered() -{ - controls->show(); -} - void MainWindow::on_action_AFOff_triggered() { g_Config.iAnisotropyLevel = 0; diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index ed02e88670..21a68d911f 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -10,7 +10,6 @@ #include "debugger_memory.h" #include "debugger_memorytex.h" #include "debugger_displaylist.h" -#include "controls.h" class QtEmuGL; namespace Ui { @@ -79,9 +78,6 @@ private slots: void on_action_OptionsFastMemory_triggered(); void on_action_OptionsIgnoreIllegalReadsWrites_triggered(); - // Controls - void on_action_OptionsControls_triggered(); - // Video void on_action_AFOff_triggered(); void on_action_AF2x_triggered(); @@ -155,9 +151,6 @@ private: Debugger_Memory *memoryWindow; Debugger_MemoryTex *memoryTexWindow; Debugger_DisplayList *displaylistWindow; - Controls *controls; - - QSet pressedKeys; }; #endif // MAINWINDOW_H diff --git a/Qt/mainwindow.ui b/Qt/mainwindow.ui index 0ee43cc45c..8748b9832b 100644 --- a/Qt/mainwindow.ui +++ b/Qt/mainwindow.ui @@ -178,12 +178,6 @@ - - - Co&ntrols - - - &Core @@ -196,7 +190,6 @@ - @@ -357,11 +350,6 @@ Ctrl+M - - - &Keyboard - - &Toggle fullscreen