Input Actions and XBox One Controller Mouse
- Silvan Bauer
- Oct 20, 2022
- 2 min read
So the last few days I was migrating my InputActions project and XBox One Controller Mouse application and uploading the InputActions to NuGet.
Input Actions
Input Actions is an open-source library created by me and released under the MIT license. I created it when I was curious about making user inputs and receiving user inputs. It was actually the first project where I used the User32.dll and so there was quite some confusion during the creation of Input Actions but with testing around and trying out I was able to figure out how to use the User32.dll. But since it wasn't so easy to create and needed a bit of code I decided to make a class library for simulating and receiving user input and output actions. And since I was already at it I also added support for processing xbox controller inputs.
The small library was created to provide easy to use classes to receive input and simulate output actions. It contains various methods for keyboards and mouses. With keyboards you can press keys and hold keys and for the mouse you have methods to move the cursor and to press mouse buttons and scroll the wheel horizontally and vertically. To receive the input you can create hooks for the keyboard and the mouse.
XBox One Controller Mouse
So since I had created the Input Actions class library and also a way to receive XBox controller inputs I thought that it might be interesting to make an application which lets you manipulate the mouse with a controller. The XBox One Controller Mouse is also licensed under the open-source MIT license.
With the XBox One Controller Mouse you can use your XBox Controller (only tested with XBox One controller) as a mouse. With the left stick you move the cursor (speed can be adjusted in the settings) and with the right you can scroll. To make a left click you press A and for a right click B.
I don't actually think there will be many use cases in which you will need or want to use your XBox controller as mouse but maybe it still is usefull if you have connected your laptop to your TV to stream with your laptop and want to use the XBox controller as input instead of a mouse when sitting on the sofa and watching what you are streaming.
Conclusion
I hope the InputActions class library helps other developers who want to make mouse or keyboard outputs or receive inputs in making the developing easier since you can use my classes in the library instead of implementing your own by using the User32.dll. And who knows maybe even the XBoxOneControllerMouse is of use to someone ;).
Comments