			     		**** PolyDraw ****

Polyline drawing utility for vdecampo's Polylib Graphics Engine (for FreeBASIC)

===============================================================================
		 	   	  Version 1.01, 30.08.2010.
===============================================================================

PolyDraw is a polyline designer for drawing polyline shapes, featuring
user-friendly controls, various drawing help tools (center polyline, mirror
polyline, ...), and supporting penup option and line colors in RGBA (24-bit depth). 
Polylines are saved in plain text files, saving each vertex x and y position, line 
color and penup value (1 = TRUE, 0 = FALSE). The designer uses Vincent DeCampo's 
Polylib (coded in FreeBASIC), and it is primarily meant to be used with that lib, 
but due the simplicity of the file format in which the polylines are saved, you can 
use it with any sort of code that manipulates with polylines defined with vertices.


To use with Polylib, copy Load_Polygon sub into your program to create polylines 
saved with this program:

////////////////////////////////////////////

Sub Load_Polygon (p_filename as string, loaded_p as _polygon)

dim as double px,py
dim as uinteger clr
Dim As Integer file_num
file_num = FreeFile( )    

OPEN p_filename FOR INPUT AS #file_num

FOR count_vertices AS Integer = 0 TO loaded_p.num_vert - 1
    loaded_p.RemoveVertex(count_vertices)
NEXT count_vertices
DO
INPUT #file_num, px
INPUT #file_num, py
INPUT #file_num, clr
INPUT #file_num, newpoint
loaded_p.AddVertex(px,py,clr,newpoint)
LOOP UNTIL EOF(file_num)

CLOSE #file_num
    
End sub

//////////////////////////////////////////////

Keyboard controls:

WASD 					- camera movement
UP/DOWN arrow key			- zooms in/out polyline
LEFT/RIGHT arrow key			- rotates polyline
Left mouse click 			- adds a new vertex on the mouse cursor position (hold left mouse click to move it)
Right mouse click 			- hold it to drag/move the position of the currently selected vertex (line color 
				  	  is also changed according to the currently selected one before the right click)
Remo(V)e vertex				- removes currently selected vertex (indicated with green color)
(I)nsert new vertex			- inserts a new vertex in front of the currently selected one on the mouse c
				  	  cursor position
(C)enter polyline			- moves vertices to align around polyline center
(0) rotate				- returns angle of rotation to 0
No (Z)oom		      		- returns zoom value to 1 (no zoom)
(H)ome camera          			- returns camera to center
Switch vertex (PG UP/DOWN)		- scrolls between vertices
(O)n snap				- turns on/off on snap (snaps the cursor on 1 pixel grid for zoom 1)
Snap to verte(X)			- turns on/off snap to vertex mode (snaps to vertex that is less that 
				 	  5 pixels from the mouse cursor)
(T)urn on/off vertices			- turns on/off vertices on the polyline (circles drawn around them)
Clos(E) polyline			- closes the polyline (connects the last vertex with the first one)
(M)irror polyline			- mirrors the polyline based on the position of the LAST vertex
(N)ew polyline				- deletes the current polyline
Load/Unload secondary polyline (F5/F6)	- loads/unloads secondary polyline of choice for comparison
					  		  with the working one
Load BMP sprite (F7)				- loads a BMP sprite you can draw around (pasted in the center of the screen)
Hide/unhide BMP sprite (F8)			- hides/unhides the BMP sprite if it has been loaded
ALT + U/R				- undo/redo
Save (F1)				- save polyline (prompts you to input file name if you are 
					  saving it for the first time
Save as (F2)				- saves polyline onto inputted file name
Load (F3)				- loads polyline from inputted file name
Hide interface(F9)			- hides/unhides interface
Sca(L)e polyline			- scales polyline by inputted factor
Shi(F)t center				- shifts the center of polyline to a desired position (best used with snap to vertex)
1/2					- if on snap is active, this changes the grid size (1X1 or 5x5 or 10x10)
TAB					- toggle between black/white color sheme
(Q)uit					- quits the designer


Bug fixes:

Ver.1.01 - Memory leak with snap to vertex fixed

To do:

* shape generators (stars and n-gons) -> separate program


~ Lachie D. (lachie13@yahoo.com)

