

This is WIP of a line-based polygon editing tool for pico.
It's very simple and is meant to help you design polygons faster and export them to use with code later.
Some features:
- Click-click with your mouse to create new vertices and link them together
- X: New Polygon
- H: Help
- G: Enable or disable magnetic grid
- U: Unlimited undo
- R: Unlimited redo(!)
- S:16x16 preview
- E: Export to lua arrays of polygons (need to run pico8 from the terminal to get the text output)
local poly = { { {25,43}, {40,34}, {47,50}, {68,44}, {59,69}, {88,71}, {81,95}, {101,104}, {72,122}, {68,90}, {34,85}, {48,56}, {21,57}, }, { {22,65}, {39,63}, {32,77}, {22,81}, {23,76}, {18,76}, {20,71}, {13,68}, } } |
That's it for now as it seems it's almost doing what I need now.



(took me forever to find that space closes current shape - why not x/c?)
Got that error:



@freds72, that's a good suggestion for x/c
You probably got the error because you hit space twice, didn't you?



@freds72 Both issues are fixed :)
- X replaces [spc] to create a new poly
- [fix/crash] Creating multiple empty polys is now ignored at poly insertion



I rewrote most of the polygon generation code because it was messy. It's much better now.
I also use the same code to paint and export polys and added a redo feature.
The cart also boots with the help screen.


What's missing?
- Load/save functions that work nicely
- Filled polygons
- Palette editor
- Customizable preview



@Oct, I would be very interested in seeing you do filled polygons. That is something I would find difficult to write. Gold star to you for encouragement.



Took me longer than @ChristopherD (you know, 1st implem, bugs, more bugs, no more bugs), but, I'm close right?

Next up, a palette selector and more cleanup. Also, the refresh rate slows down quickly (interested in any of @ChristopherD tricks there ;))...
I use a basic scanline algorithm FWIW



@Oct I doubt mine was done any faster than yours. I had already done that for my project; just posted to share is all.
I have no idea what you're doing, so I can't give you any specific tricks/advice. That said, I also found refresh rate slowed down as I drew more polygons. I got a big boost in performance by caching the lines calculated by the scanline algorithm when I closed a polygon. _draw() only draws cached lines, never from the algorithm.
[Please log in to post a comment]