Home

Awesome

<h1 align="center">Polygon Editor</h1> <p align="center"> <img src="https://github.com/ArtemkaKun/polygon-editor/assets/36485221/88afe641-bf52-4e08-8df5-7a09860652c5/polygoneditordemo.gif" alt="animated" /> </p>

About

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 ⚠️), it's built using the V programming language and V UI framework, offering a fast and lightweight tool. This project is open-source and is licensed under the MIT license.

Key Features

Dependencies

Usage

  1. Begin by selecting a sprite that will serve as your reference for creating a polygon. You can do this by navigating to File... then selecting Open sprite file.
  2. After your sprite is loaded, create a new polygon file. This can be done by going to File... and choosing Create new polygon.
  3. 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.
  4. Once you're satisfied with your polygon, ensure to save your work. Navigate to File... and then Save polygon. Your polygon will now be safely stored for future use or modification.

User Interface

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

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
         }
      }
   ]
}

Future Enhancements

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Donations

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.

More about my projects

Subscribe to my Mastodon account to find more info about my projects.