vert.c (494B)
1 #include "vert.h" 2 #include <stdlib.h> 3 #include <stdio.h> 4 5 Vertex gen_vertex() { 6 int y = rand() % 1440; 7 int x = rand() % 5120; 8 Vertex v; 9 v.x = x; 10 v.y = y; 11 return v; 12 } 13 14 void print_vertex(Vertex* v) { 15 printf("x: %i, y: %i", v->x, v->y); 16 } 17 18 Vertex* gen_vertices(int vtCount) { 19 Vertex* vertices = (Vertex*)malloc(sizeof(Vertex) * vtCount); 20 for(int i = 0; i < vtCount; ++i) { 21 Vertex v = gen_vertex(); 22 vertices[i] = v; 23 } 24 return vertices; 25 26 }