{"id":21989097,"url":"https://github.com/repcomm/gameinput-ts","last_synced_at":"2026-04-09T12:35:51.178Z","repository":{"id":130854162,"uuid":"309790069","full_name":"RepComm/gameinput-ts","owner":"RepComm","description":"procedural input for javascript/typescript","archived":false,"fork":false,"pushed_at":"2021-07-30T22:22:13.000Z","size":138,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T15:10:50.704Z","etag":null,"topics":["html","input","javascript","lib","npm","remap","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@repcomm/gameinput-ts","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RepComm.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-03T19:42:52.000Z","updated_at":"2022-09-18T14:06:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"9cfd95ee-c37e-432c-b6cf-8e41e63b9f75","html_url":"https://github.com/RepComm/gameinput-ts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RepComm/gameinput-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fgameinput-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fgameinput-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fgameinput-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fgameinput-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RepComm","download_url":"https://codeload.github.com/RepComm/gameinput-ts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RepComm%2Fgameinput-ts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266631561,"owners_count":23959420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","input","javascript","lib","npm","remap","typescript"],"created_at":"2024-11-29T19:27:45.514Z","updated_at":"2025-12-30T22:06:58.818Z","avatar_url":"https://github.com/RepComm.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# gameinput-ts\nRuntime re-mappable procedural input for the web\n\n# current-support\n- keyboard\n- mouse\n- touch\n- gamepad\n- importing JSON input mappings during runtime!\n\n# future-support\n- UI elements\n- WebSocket API\n\n# how it works\nThe main idea:\n- Anything can be a button\n- Anything can be an axis\n\nAnything being:\n- keyboard buttons\n- mouse buttons\n- mouse axes\n- touch\n- gamepad buttons\n- gamepad axes\n- HTML elements\n\n## Classes\n- Input (raw, hooks into browser APIs, used by GameInput)\n- GameInput - main API\n- Button - unique names, boolean state\n- Axis - unique names, floating point state\n\n## Using\n### Installing\n- Via NPM (usage with webpack or snowpack, which are tested)\n\u003cbr\u003e\n```\nnpm install @repcomm/gameinput-ts\n```\n```ts\nimport { GameInput } from \"@repcomm/gameinput-ts\";\n```\n- Browser ESM script:\n\u003cbr\u003e\n```js\n\u003cscript type=\"module\"\u003e\nimport { GameInput } from \"/path/to/gameinput/mod.js\";\n\u003c/script\u003e\n```\n\n### Example Usage\n```js\n\n//so we can use await\nasync function main () {\n  \n  //get the singleton\n  let input = GameInput.get();\n  \n  //create an axis\n  input.getOrCreateAxis (\"forward\")\n  .addInfluence ({\n    //value when triggered by boolean state (such as keys, mouse buttons, gamepad buttons)\n    value: 1.0,\n    \n    //make it influenced by first mouse button\n    mouseButtons:[0],\n    \n    //you can also make it take on the value of the mouse axes\n    mouseAxes:[0],\n    //scale factor when activated by mouse/touch\n    pointerAxisScale: 0.5,\n    \n    //use gamepad axes!\n    gpAxes:[0],\n    //scale factor when activated by gamepad axes\n    gpAxisScale: 2,\n    //force use of specific connected gamepad\n    gpIndex: 0\n  });\n  \n  //You can also supply JSON!\n  const inputMapFile = \"./demo.input.json\";\n  console.log(`Fetching ${inputMapFile}`);\n  let config = await (await fetch( inputMapFile )).json();\n\n  //button and axis definitions will merge with pre-existing buttons and axes\n  input.addJsonConfig( config );\n  \n  //loop\n  let fps = 30;\n  setInterval (()=\u003e{\n    //get the axis value\n    let fwd = input.getAxisValue (\"forward\");\n    \n    console.log(fwd);\n    \n  }, 1000/fps);\n\n}\n\nmain();\n\n\n```\n\n## Compiling\nTo build you'll want to clone the repo\u003cbr\u003e\n`git clone https://github.com/RepComm/gameinput-ts.git`\n\n## Install dev dependencies\n`npm install`\n## Build\n`npm run build`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepcomm%2Fgameinput-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frepcomm%2Fgameinput-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepcomm%2Fgameinput-ts/lists"}