return 0;
}
-static void loop(SDL_Surface *screen, int num_of_planets)
+static void loop(SDL_Surface *screen, int num_of_planets, double total_mass,
+ double range)
{
struct planet *planet, *pl1, *pl2;
struct camera camera;
planet = malloc(sizeof(*planet));
init_planet(planet);
- create_planets(planet, num_of_planets, 50000, 500);
+ create_planets(planet, num_of_planets, total_mass, range);
ticks = SDL_GetTicks();
while (1) {
SDL_Surface *screen;
int flags = SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_RESIZABLE;
int planets = 100, xres = 800, yres = 600;
+ double total_mass = 50000;
+ double range = 500;
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
fprintf(stderr, "Unable to initialize SDL: %s\n",
planets = atoi(argv[1]);
if (argc >= 3)
- xres = atoi(argv[2]);
+ total_mass = atof(argv[2]);
if (argc >= 4)
- yres = atoi(argv[3]);
+ range = atof(argv[3]);
screen = SDL_SetVideoMode(xres, yres, 32, flags);
if (screen == NULL) {
return 2;
}
- loop(screen, planets);
+ loop(screen, planets, total_mass, range);
return 0;
}