Polygon Editor is a desktop application designed for game developers to create and edit 2D polygon
shapes to be used as colliders in their games. Compatible with Linux systems (only
- Sprite and Polygon loading: Load sprites (PNG) and existing polygons (JSON) for editing.
- Polygon drawing: Draw polygons on the loaded sprite by adding points with left mouse clicks.
- Point modification: Modify polygons by moving the points around.
- Point deletion: Remove points from the polygon via right-click.
- Status indications: Display status messages like "Polygon saved", "Sprite opened", etc.
- Begin by selecting a sprite that will serve as your reference for creating a polygon.
You can do this by navigating to
File...
then selectingOpen sprite file
. - After your sprite is loaded, create a new polygon file. This can be done by going to
File...
and choosingCreate new polygon
. - You can now start shaping your polygon. Left-click with your mouse to add points. If you need to remove points, a right-click will do the trick. To reposition a point, simply press and hold the left mouse button and drag the point to your desired location.
- Once you're satisfied with your polygon, ensure to save your work.
Navigate to
File...
and thenSave polygon
. Your polygon will now be safely stored for future use or modification.
The UI consists of a panel bar at the top and a viewport. The panel bar includes a "File..." button that provides a dropdown menu with options for opening and saving sprites and polygons. The viewport displays the loaded sprite and the drawn polygon.
Export polygons as JSON files (Polygon
structure from
v-2d-polygon-colliders library).
Each point is represented by an object (Position
structure from
v-2d-transform library) with x and y properties
for its coordinates.
Note
It's crucial to remember that these point positions are not based on global coordinates, but rather they exist within the local space of the sprite used as a reference. This means that their position is defined relative to the origin point of the sprite, rather than the overall coordinate system. See Local to Global and Global to Local conversions examples.
{
"points":[
{
"Vector":{
"x":0.05,
"y":4.05
}
},
{
"Vector":{
"x":1.0,
"y":2.0
}
},
{
"Vector":{
"x":3.05,
"y":0.0
}
}
]
}
- Dynamic zoom
- Undo/redo functionality
- Pixel precision grid
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
If you like this project, please consider donating to me or the V language project. Your donations will help me to continue to develop this project and the V language.
Subscribe to my Mastodon account to find more info about my projects.