jkuhlmann / gainput

Cross-platform C++ input library supporting gamepads, keyboard, mouse, touch
http://gainput.johanneskuhlmann.de/
MIT License
857 stars 103 forks source link

Programmatically trigger input events with custom platform #18

Closed iukpo closed 7 years ago

iukpo commented 8 years ago

Hello! I am working with a custom platform that is not Linux, Windows, or Android, but I want to be able to use your event handlers with my custom platform so that objects listening for events in my software can react to gamepad events from the platform. This is what I mean in pseudocode:

if(custompaltforminput.isButtonDown(...)) { map button in custom platform to user defined button create event with user defined button name, coordinates, etc. trigger event }

Is this possible?

jkuhlmann commented 8 years ago

So what you are asking is basically to implement a new source for inputs, right? In that case you would have to provide a new implementation of the InputDevice interface. Then you can instantiate that and register with the InputManager. After it should just work like and other input device.

Does that help?