-
Notifications
You must be signed in to change notification settings - Fork 1
User Input
Mike Puskar edited this page Dec 29, 2021
·
2 revisions
IPT.Common has a built-in InputHandler class that automatically starts and stops fibers for monitoring user input. Each SettingKeyCombo or SettingButtonCombo in the Configuration object will have a fiber monitoring that combination which will raise an OnUserInputChanged event.
var config = new Config();
var inputHandler = new InputHandler(config);
inputHandler.Start();
Events.OnUserInputChanged += Events_OnUserInputChanged
private void Events_OnUserInputChanged(GenericCombo combo)
{
if (combo == this.config.SomeKey.Value)
{
Logging.Info($"detected some key, IsPressed = {combo.IsPressed}");
}
}