{"id":21436820,"url":"https://github.com/mtojo/node-game","last_synced_at":"2025-07-14T14:33:26.404Z","repository":{"id":6143746,"uuid":"7372600","full_name":"mtojo/node-game","owner":"mtojo","description":"Game loop library for Node.js","archived":false,"fork":false,"pushed_at":"2021-05-13T19:12:26.000Z","size":6,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-22T10:57:00.626Z","etag":null,"topics":["game-loop","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/mtojo.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}},"created_at":"2012-12-30T02:16:46.000Z","updated_at":"2022-02-01T02:21:53.000Z","dependencies_parsed_at":"2022-07-21T13:02:28.696Z","dependency_job_id":null,"html_url":"https://github.com/mtojo/node-game","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtojo%2Fnode-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtojo%2Fnode-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtojo%2Fnode-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtojo%2Fnode-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtojo","download_url":"https://codeload.github.com/mtojo/node-game/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225981809,"owners_count":17554923,"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","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":["game-loop","nodejs"],"created_at":"2024-11-23T00:15:56.639Z","updated_at":"2024-11-23T00:15:57.315Z","avatar_url":"https://github.com/mtojo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-game\n\nGame loop library for Node.js.\n\n## Installation\n\n```bash\n$ npm install --save https://github.com/mtojo/node-game.git\n```\n\n## Usage\n\n```js\nconst Game = require('game');\n\nconst game = new Game({\n  framesPerSecond: 60,\n  maxFrameSkip: 10,\n  waitTime: 0\n});\n\ngame.on('init', () =\u003e {\n  // This function is called when the Game object is initialized.\n});\n\ngame.on('start', () =\u003e {\n  // This function is called when the game loop is started.\n});\n\ngame.on('update', () =\u003e {\n  // This function is called every frame.\n});\n\ngame.on('stop', () =\u003e {\n  // This function is called when the game loop is stopped.\n});\n\ngame.start();\n```\n\n## API\n\n### Game\n\n#### constructor(options = {})\n\n##### options\n\n| Name | Description | Default |\n| ---- | ----------- | ------- |\n| `framesPerSecond` | Frames per second. | `60` |\n| `maxFrameSkip` | Max number for frame skip. | `10` |\n| `waitTime` | Milliseconds for loop wait. | `0` |\n\n#### get isRunning\n\ntype: `boolean`\n\nReturns whether the game loop is running.\n\n#### get updateTicks\n\ntype: `number`\n\nReturns the number of the updated.\n\n#### get currentTick\n\ntype: `number`\n\nReturns the number of the updated on current second.\n\n#### set framesPerSecond\n\ntype: `number`\n\nSets the frames per second.\n\n#### get framesPerSecond\n\ntype: `number`\n\nReturns the frames per second.\n\n#### set maxFrameSkip\n\ntype: `number`\n\nSets the max number for frame skip.\n\n#### get maxFrameSkip\n\ntype: `number`\n\nReturns the max number for frame skip.\n\n#### set waitTime\n\ntype: `number`\n\nSets the milliseconds for loop wait.\n\n#### get waitTime\n\ntype: `number`\n\nReturns the milliseconds for loop wait.\n\n#### start()\n\nStarts the game loop.\n\n#### stop()\n\nStops the game loop.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtojo%2Fnode-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtojo%2Fnode-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtojo%2Fnode-game/lists"}