mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add mousewheel support
This commit is contained in:
parent
ac843b0b1e
commit
e195377d20
3 changed files with 19 additions and 4 deletions
|
@ -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.
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue