It is F# wrapper for BrandonPotter/XBoxController
For now, I'm only able to use it on Windows machine, since it uses kernel32.dll
inside, which is only on Windows.
async {
let! controller = Controller.waitFor Controller.Any
printfn "Controller is connected (%A)" controller
let! _ =
[
controller |> Controller.onButtonPressedAsync Medium (function
| button -> printfn "Button pressed %A" button
)
controller |> Controller.onPositionChangedAsync Medium (function
| PositionChanged.Lt (TriggerPressedPower power) -> printfn "Lt -> %A" power
| PositionChanged.Rt (TriggerPressedPower power) -> printfn "Rt -> %A" power
| PositionChanged.ThumbPadLeft { X = x; Y = y } -> printfn "ThumbPadLeft X: %A, Y: %A" x y
| PositionChanged.ThumbPadRight { X = x; Y = y } -> printfn "ThumbPadRight X: %A, Y: %A" x y
)
]
|> Async.Parallel
return ()
}