{"id":22826957,"url":"https://github.com/phasereditor2d/phasereditor2d-roundedrectangle-plugin","last_synced_at":"2025-07-09T17:39:27.386Z","repository":{"id":57322908,"uuid":"442144236","full_name":"PhaserEditor2D/phasereditor2d-roundedRectangle-plugin","owner":"PhaserEditor2D","description":"A Phaser Editor 2D plugin with support for the RoundedRectangle game object.","archived":false,"fork":false,"pushed_at":"2022-05-25T02:36:39.000Z","size":158,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-03T18:58:48.274Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/PhaserEditor2D.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-12-27T11:45:21.000Z","updated_at":"2023-03-10T06:55:51.000Z","dependencies_parsed_at":"2022-08-25T20:00:09.651Z","dependency_job_id":null,"html_url":"https://github.com/PhaserEditor2D/phasereditor2d-roundedRectangle-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/PhaserEditor2D/phasereditor2d-roundedRectangle-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhaserEditor2D%2Fphasereditor2d-roundedRectangle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhaserEditor2D%2Fphasereditor2d-roundedRectangle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhaserEditor2D%2Fphasereditor2d-roundedRectangle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhaserEditor2D%2Fphasereditor2d-roundedRectangle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhaserEditor2D","download_url":"https://codeload.github.com/PhaserEditor2D/phasereditor2d-roundedRectangle-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhaserEditor2D%2Fphasereditor2d-roundedRectangle-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262329451,"owners_count":23294693,"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-12-12T18:07:11.045Z","updated_at":"2025-07-09T17:39:27.326Z","avatar_url":"https://github.com/PhaserEditor2D.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phaser Editor 2D v3 - RoundedRectangle plugin\n\nThis repository contains RoundedRectangle plugin for Phaser Editor 2D v3.\n\n*This RoundedRectangle implementation is based on a `Phaser.GameObjects.RenderTexture` and has a poor performance. For a better implementation, check the [phasereditor2d-roundedRectangleGraphics-plugin](https://github.com/PhaserEditor2D/phasereditor2d-roundedrectanglegraphics-plugin).*\n\n## Install\n\nThe plugin is distributed as a NodeJS package:\n\n```bash\n$ npm i --save-dev phasereditor2d-roundedrectangle-plugin\n```\n\nIt is important that you install the package as a development dependency (`--save-dev`), because Phaser Editor 2D only searches for plugins in that section. Also, the `package.json` file should be in the root of the project.\n\n## Creating a RoundedRectangle object\n\nFor creating a RoundedRectangle object, you can drag the **RoundedRectangle** type from the **Built-In** section of the **Blocks** view and drop it in the scene.\n\nBy default, it shows a white rectangle:\n\n![Create object](images/create-roundedRectangle.png)\n\n## RoundedRectangle parameters  \n\nA RoundedRectangle object is similar to the Rectangle game object. It has size, background, stroke, in addition to specific properties, like radius, and shadow.\n\nThe shadow is part of the bound of the object, it means, if you increase the shadow offset, the background of the object decreases.\n\n![RoundedRectangle properties](images/properties.png)\n\nThere are other properties common to the RenderTexture object, like those in the sections Transform, Origin, Visible, etc...\n\n## Size manipulators\n\nYou can resize the RoundedRectangle object with the **Size Tool**. Press the `Z` key or select this tool in the context menu **Tools** \u003e **Resize Tool**.\n\n![Resize tool](images/size-tool.png)\n\n## Code generation\n\nThe RoundedRectangle object is not available in the Phaser built-in API. Phaser Editor 2D uses an internal implementation of this object, and provides the source code of a RoundedRectangle game object that you can use in your project.\n\nTo get the source code of the RoundedRectangle game object, execute the command **Create Rounded Rectangle User Files**:\n\n![Create rounded rectangle files command](images/create-files-commands.png)\n\nYou can open the Command Palette in the main menu or by pressing the `Ctrl+K` keys.\n\nLook you there are four different commands:\n\n* For creating JavaScript files as ES modules.\n* For creating simple JavaScript files.\n* For creating TypeScript files as ES modules.\n* For creating simple TypeScript files.\n\nThese commands create a series of files with the source code of the RoundedRectangle object. The files are copied in the folder selected in the **Files** view.\n\n![Rounded rectangle user files](images/api-files.png)\n\nThe files are following:\n\n### `RoundedRectangle.ts`\n \nContains the implementation of the RoundedRectangle game object.\n\nYou can create a new instance like this:\n\n```javascript\nconst obj = new RoundedRectangle(scene, 10, 10, 100, 100);\nscene.add.existing(obj);\n```\n\n### `registerRoundedRectangleFactory.ts`\n\nContains the `registerRoundedRectangleFactory()` function. \n\nYou should use it for registering a `GameObjectFactory` method. It allows you creating new RoundedRectangle objects like this: \n\n```javascript\nconst obj = this.add.roundedRectangle(10, 10, 100, 100);\n```\nBefore, you need to register the factory:\n\n```javascript\n\nconst game = new Phaser.Game(...);\n...\nregisterRoundedRectangleFactory();\n...\n```\n\n### `roundedRectangle.d.ts`\n\nContains the TypeScript definitions. Maybe you should move it to the `types` folder of your project. Or you should configure the `tsconfig.json` file finding the definitions.\n\n### Code customization\n\nYou are free to change the code of the generated RoundedRectangle files, however, take in consideration that the scene's code generated by the editor uses always the same public interface of the RoundedRectangle object.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphasereditor2d%2Fphasereditor2d-roundedrectangle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphasereditor2d%2Fphasereditor2d-roundedrectangle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphasereditor2d%2Fphasereditor2d-roundedrectangle-plugin/lists"}