Support different colours for different vertices
This commit is contained in:
11
graph.h
11
graph.h
@ -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;
|
||||
|
Reference in New Issue
Block a user