visualizations

Programmatic visualizations
git clone git://git.laack.co/visualizations.git
Log | Files | Refs | README

draw.c (679B)


      1 #include "raylib.h"
      2 #include "edge.h"
      3 #include <stdio.h>
      4 
      5 #define VERTEX_SIZE 5
      6 
      7 void draw_edges(Edge* edges, int length) {
      8     for(int i = 0; i < length; ++i) {
      9         Edge e = edges[i];
     10 
     11         Vertex v1 = *e.v1;
     12         Vertex v2 = *e.v2;
     13         
     14         // TODO: Convert this to a function.
     15         Vector2 v1_p;
     16         v1_p.x = v1.x;
     17         v1_p.y = v1.y;
     18         Vector2 v2_p;
     19         v2_p.x = (float)v2.x;
     20         v2_p.y = (float)v2.y;
     21         DrawLineEx(v1_p, v2_p, 1,DARKGRAY);
     22     }
     23 }
     24 
     25 void draw_vertices(Vertex* vertices, int length) {
     26     for(int i = 0; i < length; ++i) {
     27         Vertex v = vertices[i];
     28         DrawCircle(v.x,v.y,VERTEX_SIZE, WHITE);
     29     }
     30 }
     31