#include #include #include #include #include #include #include #define FILENAME_INPUT "./res/spotlight.frag" #define FILENAME_OUTPUT "./build/spotlight.frag.c" int main (int argc, char *argv[]) { remove (FILENAME_OUTPUT); int fd = open (FILENAME_INPUT, O_RDONLY); if (fd == -1) { perror ("open"); return EXIT_FAILURE; } struct stat sb; if (fstat (fd, &sb) == -1) { perror ("fstat"); close (fd); return EXIT_FAILURE; } void *mapped = mmap (NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (mapped == MAP_FAILED) { perror ("mmap"); close (fd); return EXIT_FAILURE; } if (!ExportDataAsCode (mapped, sb.st_size, FILENAME_OUTPUT)) { perror ("raylib"); close (fd); return EXIT_FAILURE; } if (munmap (mapped, sb.st_size) == -1) perror ("munmap"); close (fd); if (chmod (FILENAME_OUTPUT, S_IRUSR | S_IRGRP | S_IROTH) == -1) { perror ("chmod"); return EXIT_FAILURE; } return EXIT_SUCCESS; }