Add mousewheel support

This commit is contained in:
Henrik Rydgard authored and Henrik Rydgård committed 2017-03-23 10:02:28 +01:00
1 parent ac843b0b1e
commit e195377d20
3 files changed
+19 -4

No files matched your search

+2 -4
View File
@@ -136,10 +136,8 @@ void App::OnPointerCaptureLost(Windows::UI::Core::CoreWindow^ sender, Windows::U
void App::OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
int pointerId = args->CurrentPoint->PointerId;
float X = args->CurrentPoint->Position.X;
float Y = args->CurrentPoint->Position.Y;
int64_t timestamp = args->CurrentPoint->Timestamp;
m_main->OnTouchEvent(TOUCH_WHEEL, pointerId, X, Y, timestamp);
float delta = args->CurrentPoint->GetCurrentPoint(args->CurrentPoint->PointerId)->Properties->MouseWheelDelta;
m_main->OnMouseWheel(delta);
}
// Initializes scene resources, or loads a previously saved app state.
+15
View File
@@ -212,6 +212,21 @@ void PPSSPP_UWPMain::OnKeyUp(int scanCode, Windows::System::VirtualKey virtualKe
}
}
void PPSSPP_UWPMain::OnMouseWheel(float delta) {
int key = NKCODE_EXT_MOUSEWHEEL_UP;
if (delta < 0) {
key = NKCODE_EXT_MOUSEWHEEL_DOWN;
} else if (delta == 0) {
return;
}
KeyInput keyInput{};
keyInput.keyCode = key;
keyInput.deviceId = DEVICE_ID_MOUSE;
keyInput.flags = KEY_DOWN | KEY_UP;
NativeKey(keyInput);
}
void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) {
// It appears that Windows' touchIds start from 1. Let's fix that.
touchId--;
+2
View File
@@ -49,6 +49,8 @@ public:
void OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp);
void OnMouseWheel(float delta);
// Save state fast if we can!
void OnSuspend();
void Close();