command line argument to shader

This commit is contained in:
Rakarake 2025-12-14 23:01:30 +01:00
parent 864df46d69
commit a32e44f45f
5 changed files with 24 additions and 11 deletions

View file

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
#include <string.h>
#include <wayland-client.h>
#include <wayland-util.h>
#include <SDL3/SDL.h>
@ -79,7 +79,7 @@ double time_since_start() {
(now.tv_nsec - program_start.tv_nsec) / 1e9;
}
int main() {
int main(int argc, char *argv[]) {
init_timer();
printf("Good Morning 🍵\n");
@ -119,8 +119,16 @@ int main() {
}
}
char *shader_path = NULL;
if (argc >= 2) {
shader_path = argv[1];
} else {
printf("need to supply path to shader\n");
exit(1);
}
double time = time_since_start();
render(&renderer, w, h, time);
render(&renderer, w, h, time, shader_path);
SDL_GL_SwapWindow(window);
}