Polyline Editor
Using a mouse and keyboard to do polyline editing.
- A house in the process of being drawn. The user has just clicked at the position drawn, and a line has been drawn from the previous point to the one by the mouse.
- Moving a point. The user positions the cursor near the vertex of some polyline, presses down the mouse button, and “drags” the chosen point to some other location before releasing the button. Upon release of the button, the previous lines connected to this point are erased, and new lines are drawn to it.
- A point is deleted from a polyline. The user clicks near the vertex of some polyline, and the two line segments connected to that vertex are erased. Then the two other endpoints of the segments just erased are connected with a line segment.
The functionality of the program should include the following “actions”:
- Begin (‘b’) (create a new polyline)
- Delete (‘d’) (delete the next point pointed to)
- Move (‘m’) (drag the point pointed to to a new location)
- Refresh (‘r’) (erase the screen and redraw all the polylines)
- Quit (‘q’) (exit from the program)
// ConsoleApplication1-openGL-lab1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
struct point {
int x;
int y;