A user of my game plays it on Android with a mouse plugged into his device. I’ve tried adding support for zooming in and out on the game using the mouse wheel with the same SDL code that works on my Windows version by processing SDL_MOUSEWHEEL, but the Android version doesn’t seem to receive the SDL_MOUSEWHEEL message.
Does SDL on Android deal with mouse wheels? Or is there a flag or something that needs setting?
When I tested using Cxxdroid on my phone just now (fresh install) it worked fine, so I can at least confirm that the wheel event works when compiled on an up-to-date android device.
It might be an issue in the version of SDL that you are using, or it could be that your code has a bug.
Can we get a little more information about your toolchain, and maybe a glimpse at your SDL_MOUSEWHEEL event case from the code?
You can parse it down to minimal information, but try to give us enough info to attempt to recreate the issue on our side.
(You might get sick of the phrase “Minimal Reproducible Example”, but creating small testable code really is helpful.)
I’ve not had a problem getting mouse wheel events on various Android versions and SDL versions.
Does it work in the emulator when using Android Studio? Or just on an actual device?
I’m taking a guess here, but I think that unless you have settings in the emulator that send the input through a simulated usb connection, the emulator is not meant to send the mouse wheel event to the emulated phone. My guess is that the emulator’s code applies that wheel motion to it’s own window, and since the whole phone is shown the event gets ignored.
I haven’t ever tried this, but you could set up your emulator with USB Passthrough. (There probably are better tutorials, this was just the first link that popped up for me when I searched).
I haven’t figured out a way to get it to work on the emulator, and I don’t have an Android device with a mouse, so I’ll put out my updated code in the game’s next release and see what the user feedback is
As a follow up, the user has reported back that everything works fine with the mouse wheel on an actual device now. I still don’t know how to test it on the emulator, but I guess if my SDL code works with the mouse wheel on Windows I’ll just assume it’s gonna work on Android too.