diff options
Diffstat (limited to 'glslview.c')
-rw-r--r-- | glslview.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -172,17 +172,27 @@ static void handle_input(const char *input) { } static void usage(void) { - fprintf(stderr, "Usage: glslview [-t <time>] [-s <speed>] [-0 <param0>] [-1 <param1>] [-2 <param2>] <shader>\n"); + fprintf(stderr, "Usage: glslview [-w <width>] [-h <height>] [-t <time>] [-s <speed>] [-0 <param0>] [-1 <param1>] [-2 <param2>] <shader>\n"); exit(1); } int main(int argc, char *argv[]) { + int width = 800, height = 800; + while (true) { - int c = getopt(argc, argv, "t:s:0:1:2:"); + int c = getopt(argc, argv, "w:h:t:s:0:1:2:"); if (c == -1) break; switch (c) { + case 'w': + width = atoi(optarg); + break; + + case 'h': + height = atoi(optarg); + break; + case 't': current_time = init_time = atof(optarg); break; @@ -220,7 +230,7 @@ int main(int argc, char *argv[]) { SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); - SDL_Window *window = SDL_CreateWindow("glslview", 0, 0, 800, 800, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE); + SDL_Window *window = SDL_CreateWindow("glslview", 0, 0, width, height, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE); SDL_GLContext ctx = SDL_GL_CreateContext(window); filename = argv[optind]; |