{"id":"a1ternativez/fluxinput","name":"fluxinput","scope":"a1ternativez","platform":"roblox","description":"simple modular input management system","version":"2.1.1","latest":"2.1.1","versions":["1.1.1","1.1.2","1.1.3","1.1.5","1.1.6","1.1.7","1.1.8","1.1.9","1.1.91","2.1.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"b51bf5f72578d092fab3fc8511444bc475e3530f7b7261f3331723ded8dec461","likes":0,"downloads":0,"install":"forest install a1ternativez/fluxinput","url":"https://forest.dev/p/roblox/a1ternativez/fluxinput","files":"https://api.forest.dev/ai/package/roblox/a1ternativez/fluxinput/files","readme":"# FluxInput\r\n\r\n**FluxInput** is a modular input management system for Roblox.\r\nIt provides a unified API for handling keyboard, gamepad, and touch inputs.\r\n\r\nIt supports:\r\n\r\n* Input contexts (categories)\r\n* Dynamic key rebinding\r\n* Input cooldowns\r\n* Hold input detection\r\n* Event-based handling (pressed / released)\r\n\r\n---\r\n\r\n# 📥 Installation\r\n\r\n## 🔗 Latest Release\r\n\r\nDownload or access the latest version of FluxInput here:\r\n\r\n👉 [FluxInput Latest Release](https://github.com/a1ternativez/FluxInput/releases/latest)\r\n\r\n---\r\n\r\n# 📦 Core Types\r\n\r\n## KeycodeSet\r\n\r\nDevice-specific input bindings:\r\n\r\n```lua\r\ntype KeycodeSet = {\r\n    KeyboardBinding: { Enum.KeyCode }?,\r\n    GamepadBinding: { Enum.KeyCode }?,\r\n    TouchBinding: { GuiButton }?,\r\n}\r\n\r\n```\r\n\r\n---\r\n\r\n## InputInstance\r\n\r\nObject returned when an input action is registered:\r\n\r\n```lua\r\ntype InputInstance = {\r\n    Keys: KeycodeSet,\r\n    Cooldown: number,\r\n    LastPressTime: number,\r\n    Enabled: boolean,\r\n    Destroyed: boolean,\r\n\r\n    Context: InputContext,\r\n    Action: InputAction,\r\n\r\n    PressedCallbacks: { (any) -> () },\r\n    ReleasedCallbacks: { (any) -> () },\r\n    HoldCallbacks: { {Duration: number, Func: (any) -> ()} },\r\n}\r\n\r\n```\r\n\r\n---\r\n\r\n# ⚙️ API\r\n\r\n## Input.New\r\n\r\nCreates and registers a new input action inside a context.\r\n\r\n```lua\r\nInput.New(\r\n    category: string,\r\n    name: string,\r\n    keys: KeycodeSet,\r\n    cooldown: number?\r\n) -> InputInstance\r\n\r\n```\r\n\r\n---\r\n\r\n## InputInstance Methods\r\n\r\n---\r\n\r\n### Event Connections\r\n\r\n```lua\r\nConnectPressed(func: () -> ()) -> RBXScriptConnection -- pressed signal\r\nConnectReleased(func: () -> ()) -> RBXScriptConnection -- released signal\r\nConnectHold(duration: number, func: () -> ()) -> RBXScriptConnection -- hold signal\r\nConnect(func: () -> ()) -> RBXScriptConnection -- alias for ConnectPressed\r\n\r\n```\r\n\r\n---\r\n\r\n### Key Management\r\n\r\n```lua\r\nChangeKeys(keys: KeycodeSet) -> () -- change keybinds\r\n\r\n```\r\n\r\n---\r\n\r\n### State Control\r\n\r\n```lua\r\nSetState(state: boolean) -> ()          -- enable/disable this input\r\nSetContextState(state: boolean) -> ()   -- enable/disable entire category\r\n\r\n```\r\n\r\n---\r\n\r\n### Cleanup\r\n\r\n```lua\r\nDestroy() -> () -- destroys input\r\n\r\n```\r\n\r\n---\r\n\r\n# 🎮 Usage Examples\r\n\r\n---\r\n\r\n## 1. Simple Keyboard Input\r\n\r\n```lua\r\nlocal Input = require(FluxInput)\r\n\r\nlocal jump = Input.New(\r\n\t\"Player\",\r\n\t\"Jump\",\r\n\t{\r\n\t\tKeyboardBinding = { Enum.KeyCode.Space }\r\n\t},\r\n\t0.2\r\n)\r\n\r\njump:ConnectPressed(function()\r\n\tprint(\"Jump!\")\r\nend)\r\n```\r\n\r\n---\r\n\r\n## 2. Press / Release\r\n\r\n```lua\r\nlocal sprint = Input.New(\r\n\t\"Player\",\r\n\t\"Sprint\",\r\n\t{\r\n\t\tKeyboardBinding = { Enum.KeyCode.LeftShift }\r\n\t}\r\n)\r\n\r\nsprint:ConnectPressed(function()\r\n\tprint(\"Sprint ON\")\r\nend)\r\n\r\nsprint:ConnectReleased(function()\r\n\tprint(\"Sprint OFF\")\r\nend)\r\n```\r\n\r\n---\r\n\r\n## 3. Keyboard + Gamepad\r\n\r\n```lua\r\nlocal shoot = Input.New(\r\n\t\"Combat\",\r\n\t\"Shoot\",\r\n\t{\r\n\t\tKeyboardBinding = { Enum.KeyCode.F },\r\n\t\tGamepadBinding = { Enum.KeyCode.ButtonR2 }\r\n\t}\r\n)\r\n\r\nshoot:Connect(function()\r\n\tprint(\"Shoot\")\r\nend)\r\n```\r\n\r\n---\r\n\r\n## 4. Touch Input\r\n\r\n```lua\r\nlocal button = script.Parent:WaitForChild(\"JumpButton\")\r\n\r\nlocal jump = Input.New(\r\n\t\"Player\",\r\n\t\"Jump\",\r\n\t{\r\n\t\tKeyboardBinding = { Enum.KeyCode.Space },\r\n\t\tTouchBinding = { button }\r\n\t}\r\n)\r\n\r\njump:Connect(function()\r\n\tprint(\"Jump\")\r\nend)\r\n```\r\n\r\n---\r\n\r\n## 5. Rebinding Keys\r\n\r\n```lua\r\nreload:ChangeKeys({\r\n\tKeyboardBinding = { Enum.KeyCode.T }\r\n})\r\n```\r\n\r\n---\r\n\r\n## 6. Enable / Disable Input\r\n\r\n```lua\r\ndash:SetState(false)\r\ndash:SetState(true)\r\n```\r\n\r\n---\r\n\r\n## 7. Disable Entire Category\r\n\r\n```lua\r\ndash:SetContextState(false)\r\n```\r\n\r\n---\r\n\r\n## 8. Destroy Input\r\n\r\n```lua\r\ndash:Destroy()\r\n```\r\n\r\n---\r\n\r\n## 9. Hold Input\r\n\r\nTriggers only if the key is held for the specified duration.\r\n\r\n```lua\r\nlocal Input = require(FluxInput)\r\n\r\nlocal Charge = Input.New(\r\n    \"Combat\",\r\n    \"ChargeBlast\",\r\n    {\r\n        KeyboardBinding = { Enum.KeyCode.E }\r\n    }\r\n)\r\n\r\nCharge:ConnectHold(1.5, function()\r\n    print(\"Blast charged!\")\r\nend)\r\n\r\n```\r\n\r\n---\r\n\r\n## 10. Combined Press and Hold\r\n\r\n```lua\r\nlocal ability = Input.New(\r\n    \"Combat\",\r\n    \"Ultimate\",\r\n    {\r\n        KeyboardBinding = { Enum.KeyCode.Q }\r\n    }\r\n)\r\n\r\nability:ConnectPressed(function()\r\n    print(\"Charging Ultimate...\")\r\nend)\r\n\r\nability:ConnectHold(3, function()\r\n    print(\"Ultimate Released!\")\r\nend)\r\n\r\nability:ConnectReleased(function()\r\n    print(\"Charge Interrupted\")\r\nend)\r\n\r\n```","readmeTruncated":false}