#include "random.h"
#include "planet.h"
-#define SCREEN_WIDTH 800
-#define SCREEN_HEIGHT 600
-
static void fade_buf(SDL_Surface *screen, double amount)
{
int i;
buf[i] = 0;
}
-static void loop(SDL_Surface *screen)
+static void loop(SDL_Surface *screen, int num_of_planets)
{
- int num_of_planets = 100;
struct planet *planet, *pl1, *pl2;
SDL_Event event;
int i, planets;
}
}
-int main(void)
+int main(int argc, char *argv[])
{
SDL_Surface *screen;
int flags = SDL_DOUBLEBUF | SDL_HWSURFACE;
+ int planets = 100, xres = 800, yres = 600;
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
fprintf(stderr, "Unable to initialize SDL: %s\n",
}
atexit(SDL_Quit);
- screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, flags);
+ if (argc >= 2)
+ planets = atoi(argv[1]);
+
+ if (argc >= 3)
+ xres = atoi(argv[2]);
+
+ if (argc >= 4)
+ yres = atoi(argv[3]);
+
+ screen = SDL_SetVideoMode(xres, yres, 32, flags);
if (screen == NULL) {
fprintf(stderr, "Unable to set video mode: %s\n",
SDL_GetError());
return 2;
}
- loop(screen);
+ loop(screen, planets);
return 0;
}