Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
SDL: Initial implementation of joystick events #1681
This PR provides the option for engines to receive joystick events from the backend. It's based ResidualVM's joystick handling.
All games with joystick support will open the main menu when the start button is pressed.
This PR is not 100% complete. The most notable thing missing is proper handling for analog sticks. Since Pegasus Prime simply uses the analog stick to simulate mouse input, I simply opted to disable passing axis events and let the backend handle it. In the long term though, the joystick to mouse code should be moved into Common, so that it can be used by engines that need it, and the analog stick can still be used for games that need it for other purposes, such as movement in RPGs, or if it's used by the game's scripts, like it is with GrimE. (Plus it means the joystick to mouse code can be shared between backends).
I haven't implemented joystick support for games like Lands of Lore, Eye of the Beholder or Worlds of Xeen since I don't have any of them, however I've decided to open this PR anyway in case any engine authors wanted to take a look.
The way I understand it this could be merged. It would allow us to implement engine-specific controller support where needed (lol, eotb, xeen) , while keeping the existing functionality for all other engines automatically.
EDIT: It would be great to keep R shoulder on game controllers as the "slow mouse" modifier for now in all cases.
referenced this pull request
Jun 25, 2019
Many thanks for your work! This looks good to be merged, and can be used as a basis for joystick events in games where a joystick controller can be used. Three weeks have passed since this PR was created, and no negative feedback was given.
Thus, this can be merged now, and further development on this feature can be continued in-tree.