{"id":"stratiz/InputController","name":"InputController","scope":"stratiz","platform":"roblox","description":"Input controller for handling input and binding to it with support for Input Groups.","version":"2.0.1","latest":"2.0.1","versions":["1.5.0","2.0.0","2.0.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"stratiz/Cleaner":{"version":"^1.0.0"},"stratiz/Signal":{"version":"^1.0.0"}},"integrity":"93cb5833792a071b7791a4ed2eb1bf835897ff367e76cfd2dca0e6ef2650cbab","likes":0,"downloads":5,"install":"forest install stratiz/InputController","url":"https://forest.dev/p/roblox/stratiz/InputController","files":"https://api.forest.dev/ai/package/roblox/stratiz/InputController/files","readme":"# InputController\n\nCentral input handler. Bind sets of keys, gamepad buttons, or GuiButtons to named maps, listen for activation through signals, and track the current input type.\n\nInitialization happens automatically on first require. The module is client only.\n\n## Usage\n\n```lua\nlocal InputController = require(Packages.InputController)\n\nlocal jump = InputController:Bind({ Enum.KeyCode.Space, Enum.KeyCode.ButtonA })\n\njump.Began:Connect(function(activator)\n    -- input pressed\nend)\n\njump.Ended:Connect(function(activator)\n    -- input released\nend)\n```\n\n## Maps\n\nEvery bind belongs to a map. `Bind` uses the `\"Default\"` map and `BindToMap` targets a named one. Disabling a map stops all of its binds from firing, which is handy for turning off gameplay input while a menu is open.\n\n```lua\nInputController:SetMapEnabled(\"Gameplay\", false)\n```\n\n## API\n\n### InputController:Bind(enums)\n\nBinds a set of KeyCodes, UserInputTypes, or GuiButtons to the `\"Default\"` map. Returns an InputContainer.\n\n### InputController:BindToMap(mapName, enums)\n\nSame as `Bind` but targets a named map. Returns an InputContainer.\n\n### InputController:Unbind(container)\n\nRemoves a container returned by `Bind` or `BindToMap` from its map and disconnects it.\n\n### InputController:SetMapEnabled(mapName, enabled)\n\nEnables or disables every bind under a map.\n\n### InputController:GetCurrentInputType()\n\nReturns the current input type, one of `\"Keyboard\"`, `\"Touch\"`, or `\"Gamepad\"`.\n\n### InputController:OnInputTypeChanged(callback)\n\nRuns the callback with the new input type whenever it changes. Returns a connection.\n\n### InputController:GetGamepadInputState(keyCode)\n\nReturns the live InputObject for a gamepad KeyCode, or nil.\n\n### InputController.CurrentInputType\n\nThe current input type. Set as soon as the module is required.\n\n### InputController.InputTypeChangedSignal\n\nFires with the new input type when it changes.\n\n## InputContainer\n\nReturned by `Bind` and `BindToMap`.\n\n### container.Began\n\nFires with the activator each time an input begins.\n\n### container.Ended\n\nFires with the activator each time an input ends.\n\n### container.Changed\n\nFires with `(active, activator, ...)` when the active state flips.\n\n### container.Active\n\nTrue while the input is active.\n\n### container:SetGameProcessedFilter(state)\n\nFilters by the engine's gameProcessed flag. Pass `true` to fire only when the input was game processed, `false` to fire only when it was not, or `nil` to fire either way.\n\n### container:Destroy()\n\nDisconnects the container and its signals. `InputController:Unbind` calls this for you.\n","readmeTruncated":false}