Fixed first vertex bug, use pointers to track vertices (in case we want to move them easily later), and added a formula for vertex distance calculations
This commit is contained in:
@ -67,13 +67,13 @@ void GameCore::render()
|
||||
{
|
||||
DrawUtils::draw(display, background, 0, 0);
|
||||
|
||||
list<Vertex> vertices = graph.get_vertices();
|
||||
list<Vertex*> vertices = graph.get_vertices();
|
||||
list<Edge> edges = graph.get_edges();
|
||||
|
||||
for (list<Vertex>::iterator cursor = vertices.begin();
|
||||
for (list<Vertex*>::iterator cursor = vertices.begin();
|
||||
cursor != vertices.end(); cursor++)
|
||||
{
|
||||
Vertex v = *cursor;
|
||||
Vertex v = *(*cursor);
|
||||
DrawUtils::draw(display, node, v.x_min, v.y_min);
|
||||
}
|
||||
|
||||
@ -81,7 +81,8 @@ void GameCore::render()
|
||||
cursor != edges.end(); cursor++)
|
||||
{
|
||||
Edge e = *cursor;
|
||||
DrawUtils::draw_line(e.a.x, e.a.y, e.b.x, e.b.y, 2, 0x000000, display);
|
||||
DrawUtils::draw_line(display, e.a->x, e.a->y, e.b->x, e.b->y, 2,
|
||||
0x000000);
|
||||
}
|
||||
|
||||
SDL_Flip(display);
|
||||
|
Reference in New Issue
Block a user