mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-27 03:49:41 -04:00
feat: Add mouse wheel support for game input passthrough
- Implement mouse wheel event handling in SDL2 backend (emu_window_sdl2) - Add wheel event routing from GRenderWindow to input subsystem - Add debugging logs to trace mouse wheel events through input chain - Support mouse wheel input for mods like Ultracam when games are running (WIP) Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||
// SPDX-FileCopyrightText: 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <SDL.h>
|
||||
@@ -77,6 +78,11 @@ void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) {
|
||||
input_subsystem->GetMouse()->TouchMove(touch_x, touch_y);
|
||||
}
|
||||
|
||||
void EmuWindow_SDL2::OnMouseWheel(s32 x, s32 y) {
|
||||
input_subsystem->GetMouse()->MouseWheelChange(x, y);
|
||||
LOG_DEBUG(Frontend, "SDL2 Mouse wheel event: x={}, y={}", x, y);
|
||||
}
|
||||
|
||||
void EmuWindow_SDL2::OnFingerDown(float x, float y, std::size_t id) {
|
||||
input_subsystem->GetTouchScreen()->TouchPressed(x, y, id);
|
||||
}
|
||||
@@ -202,6 +208,9 @@ void EmuWindow_SDL2::WaitEvent() {
|
||||
OnMouseButton(event.button.button, event.button.state, event.button.x, event.button.y);
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEWHEEL:
|
||||
OnMouseWheel(event.wheel.x, event.wheel.y);
|
||||
break;
|
||||
case SDL_FINGERDOWN:
|
||||
OnFingerDown(event.tfinger.x, event.tfinger.y,
|
||||
static_cast<std::size_t>(event.tfinger.touchId));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||
// SPDX-FileCopyrightText: 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@@ -52,6 +53,9 @@ protected:
|
||||
/// Called by WaitEvent when the mouse moves.
|
||||
void OnMouseMotion(s32 x, s32 y);
|
||||
|
||||
/// Called by WaitEvent when the mouse wheel is scrolled
|
||||
void OnMouseWheel(s32 x, s32 y);
|
||||
|
||||
/// Called by WaitEvent when a finger starts touching the touchscreen
|
||||
void OnFingerDown(float x, float y, std::size_t id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user