{"id":15065766,"url":"https://github.com/gamestdio/pixi-engine","last_synced_at":"2025-04-10T13:32:40.053Z","repository":{"id":41264662,"uuid":"115031540","full_name":"gamestdio/pixi-engine","owner":"gamestdio","description":"Provides a minimal engine-like structure for developing games with PixiJS","archived":false,"fork":false,"pushed_at":"2018-05-22T18:38:24.000Z","size":11,"stargazers_count":74,"open_issues_count":2,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-18T11:57:46.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gamestdio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-21T17:40:08.000Z","updated_at":"2024-11-15T02:18:57.000Z","dependencies_parsed_at":"2022-09-18T03:40:20.842Z","dependency_job_id":null,"html_url":"https://github.com/gamestdio/pixi-engine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamestdio%2Fpixi-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamestdio%2Fpixi-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamestdio%2Fpixi-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamestdio%2Fpixi-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gamestdio","download_url":"https://codeload.github.com/gamestdio/pixi-engine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225708,"owners_count":21068078,"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":[],"created_at":"2024-09-25T00:47:38.477Z","updated_at":"2025-04-10T13:32:40.032Z","avatar_url":"https://github.com/gamestdio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pixi-engine\n\nProvides a minimal engine-like structure for developing games with\n[PixiJS](https://github.com/pixijs/pixi.js/).\n\n## Classes\n\n- [Application](#application)\n- [Mediator](#mediator)\n- [SceneManager](#scenemanager)\n- [PlayerPrefs](#playerprefs)\n\nAlso, consider using other packages such as [@gamestdio/mathf](https://github.com/gamestdio/mathf) and [@gamestdio/keycode](https://github.com/gamestdio/keycode).\n\n## `Application`\n\nA singleton that extends from `PIXI.Application`. You might not need to use it directly. When switching scenes using [SceneManager](#scenemanager), the `Application` is used under the hood.\n\n## `Mediator`\n\nMediators are meant for handling business logic in your game.\n\n```typescript\nimport { Mediator } from \"pixi-engine\";\n\nclass MenuMediator extends Mediator\u003cMenuView\u003e {\n\n    initialize () {\n        console.log(this.view, \"has been added.\");\n    }\n\n    destroy () {\n        console.log(this.view, \"has been removed.\");\n    }\n\n    onButtonClick () {\n        console.log(\"Let's handle the click action here!\");\n    }\n\n}\n```\n\n```typescript\nimport { mediate, action } from \"pixi-engine\";\n\n@mediate(MenuMediator)\nclass MenuView extends PIXI.Container {\n    button: PIXI.Sprite = PIXI.Sprite.fromFrame(\"my-button.png\");\n\n    @action(\"onButtonClick\")\n    handleClick () {\n        // handles the animation of this.button\n    }\n\n    // pixi-engine will call `update` method at every frame\n    update () {\n    }\n\n    // pixi-engine will call `resize` automatically when the window is resized\n    resize () {\n    }\n}\n```\n\n## `SceneManager`\n\nInspired by Unity, `SceneManager` handles switching the current active scene. Scenes are instances of `PIXI.Container`.\n\n\n```typescript\nimport { SceneManager } from \"pixi-engine\";\n\nclass MyScene extends PIXI.Container {\n    // definition of your scene\n}\n\n// Go-to target scene.\nSceneManager.goTo(MyScene);\n```\n\n## `PlayerPrefs`\n\nInspired by Unity, `PlayerPrefs` are meant for storing and retrieving data locally. Currently, it's just a wrapper for `localStorage`. In the future more adapters might be implemented to handle another storage option.\n\n```typescript\nimport { PlayerPrefs } from \"pixi-engine\";\n\n// Key-value usage\nPlayerPrefs.set(\"name\", \"Player Name\");\nPlayerPrefs.set(\"accessToken\", \"1f92h3f928h39f8h2\");\n\n// Object usage\nPlayerPrefs.set({\n    name: \"Player Name\",\n    accessToken: \"1f92h3f928h39f8h2\"\n});\n\n// Retrieving data\nconsole.log(PlayerPrefs.get(\"name\"));\n```\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamestdio%2Fpixi-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgamestdio%2Fpixi-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamestdio%2Fpixi-engine/lists"}