Support different colours for different vertices

This commit is contained in:
2011-06-23 15:10:40 -04:00
parent 9d36120f6d
commit b967542157
4 changed files with 43 additions and 16 deletions

11
graph.h
View File

@ -14,11 +14,12 @@ using std::list;
class Vertex
{
public:
Vertex(int x, int y, int r);
Vertex(int x, int y, int r, int colour = 0x000000);
int x;
int y;
int r;
int colour;
};
struct Edge
@ -39,15 +40,15 @@ class Graph
list<Edge> get_edges() const { return edges; }
void select_vertex(int x, int y);
void do_vertex(int x, int y, int r);
void do_vertex(int x, int y, int r, int colour);
Vertex* get_current_vertex() const { return current_vertex; }
void clear_current_vertex() { current_vertex = NULL; }
private:
bool vertex_would_overlap(int x, int y, int r) const;
bool crosses_edge(Edge e) const;
void add_vertex(int x, int y, int r);
void add_vertex(int x, int y, int r, int colour);
bool vertex_would_overlap(int x, int y, int r);
bool crosses_edge(Edge e);
Vertex* current_vertex;
list<Vertex*> vertices;