Update main.c

This commit is contained in:
Abdelrahman Said 2024-05-05 23:42:38 +01:00
parent b2f002b12f
commit c2391df946

View File

@ -31,9 +31,9 @@ struct point {
u32 y; u32 y;
}; };
Point point_from_index(u32 index, u32 w); internal void write_debug_ppm6(const Image *img);
void write_debug_ppm6(const Image *img); internal SDL_Texture *image_to_texture(SDL_Renderer *renderer,
SDL_Texture *image_to_texture(SDL_Renderer *renderer, const Image *img); const Image *img);
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int exit_code = EXIT_SUCCESS; int exit_code = EXIT_SUCCESS;
@ -125,17 +125,7 @@ MAIN_DESTROY_ARENA:
return exit_code; return exit_code;
} }
Point point_from_index(u32 index, u32 w) { internal void write_debug_ppm6(const Image *img) {
Point out = {0};
out.x = index % w;
out.y = (index - (index % w)) / w;
return out;
}
void write_debug_ppm6(const Image *img) {
FILE *out = fopen("test.ppm", "wb"); FILE *out = fopen("test.ppm", "wb");
char magic[] = {'P', '6', '\n'}; char magic[] = {'P', '6', '\n'};
@ -156,7 +146,8 @@ void write_debug_ppm6(const Image *img) {
fclose(out); fclose(out);
} }
SDL_Texture *image_to_texture(SDL_Renderer *renderer, const Image *img) { internal SDL_Texture *image_to_texture(SDL_Renderer *renderer,
const Image *img) {
SDL_Texture *output = NULL; SDL_Texture *output = NULL;
if (!renderer || !img) { if (!renderer || !img) {
goto IMAGE_TO_TEXTURE_RETURN; goto IMAGE_TO_TEXTURE_RETURN;