3 * @purpose Main program for N-Body simulator (single threaded)
16 int main(int argc, char ** argv)
20 System_Init(&system, (float[3]){320,240,0}, 1.0, 1.0, 0.4,1);
22 Graphics_Init("N-Body", 640, 480);
25 for (unsigned a = 0; a < 2; ++a)
27 float m = ((float)(rand() % 100))/1000.0;
30 for (unsigned i = 0; i < DIMENSIONS; ++i)
32 x[i] = (float)(rand() % 640 - 320);
33 v[i] = (float)(rand() % 100 - 50) / 100;
35 System_AddBody(&system, m, x, v);
37 System_AddBody(&system, 1.0, (float[2]){0,0}, (float[2]){0,0});
43 System_WriteData(&system, stdout);
45 Graphics_Clear(1, 1, 1); //Clear screen
46 System_Draw(&system); //Draw system
47 Graphics_Update(); //Update screen
48 Process_Events(); //Process SDL events
52 System_Destroy(&system);