Merge pull request #3245 from thedax/rightMouseBtnBind

Win32: Allow right mouse button to be bound to anything.
This commit is contained in:
Henrik Rydgård committed 2013-08-19 04:31:30 -07:00
commit 21b47dbe28
2 files changed
+20 -1

No files matched your search

+3 -1
View File
@@ -116,7 +116,9 @@ std::map<int, int> windowsTransTable = InitConstMap<int, int>
(VK_F10, NKCODE_F10)
(VK_F11, NKCODE_F11)
(VK_F12, NKCODE_F12)
(VK_OEM_102, NKCODE_EXT_PIPE);
(VK_OEM_102, NKCODE_EXT_PIPE)
(VK_LBUTTON, NKCODE_EXT_MOUSEBUTTON_1)
(VK_RBUTTON, NKCODE_EXT_MOUSEBUTTON_2);
int KeyboardDevice::UpdateState(InputState &input_state) {
// Nothing to do, all done in WM_INPUT
+17
View File
@@ -1122,6 +1122,23 @@ namespace MainWindow
mouseDeltaX += raw->data.mouse.lLastX;
mouseDeltaY += raw->data.mouse.lLastY;
KeyInput key;
key.deviceId = DEVICE_ID_MOUSE;
bool mouseRightBtnPressed = raw->data.mouse.usButtonFlags & RI_MOUSE_RIGHT_BUTTON_DOWN;
bool mouseRightBtnReleased = raw->data.mouse.usButtonFlags & RI_MOUSE_RIGHT_BUTTON_UP;
if(mouseRightBtnPressed) {
key.flags = KEY_DOWN;
key.keyCode = windowsTransTable[VK_RBUTTON];
NativeKey(key);
}
else if(mouseRightBtnReleased) {
key.flags = KEY_UP;
key.keyCode = windowsTransTable[VK_RBUTTON];
NativeKey(key);
}
// TODO : Smooth and translate to an axis every frame.
// NativeAxis()
}