First implementation of game logic and control

This commit is contained in:
2011-06-22 17:57:44 -04:00
parent 2aadb9ad7e
commit fc08adcade
5 changed files with 64 additions and 9 deletions

View File

@ -25,12 +25,24 @@ bool Graph::vertex_present(int x, int y, int size)
return false;
}
void Graph::add_vertex(Vertex v)
void Graph::add_vertex(int x, int y, int size)
{
if (vertex_present(v.x, v.y)) return;
Vertex v;
v.x = x;
v.y = y;
v.x_min = x - size/2;
v.x_max = x + size/2;
v.y_min = y - size/2;
v.y_max = y + size/2;
if (vertex_present(v.x, v.y, 25)) return;
vertices.push_back(v);
edges.push_back(Edge(last_vertex, v));
Edge e;
e.a = last_vertex;
e.b = v;
edges.push_back(e);
last_vertex = v;
}