diff --git a/CMakeLists.txt b/CMakeLists.txt index 710c3d0..c6b87b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,3 +27,4 @@ ENDIF (CMAKE_COMPILER_IS_GNUCC) add_executable(TGAReader ${SOURCE_FILES}) target_include_directories(TGAReader PUBLIC ${CMAKE_SOURCE_DIR}/include) +target_link_libraries(TGAReader PUBLIC m) diff --git a/src/TGADecode.c b/src/TGADecode.c index a24be23..53bb857 100644 --- a/src/TGADecode.c +++ b/src/TGADecode.c @@ -74,7 +74,7 @@ error: * 0x0E: (2 byte) Height * 0x10: (1 byte) PixelDepth * 0x11: (1 byte) ImageDescriptor - * Total Size: 18 Bytes + * Total Size: 18 Bytes */ static int _read_tga_header(TGAImage *image, FILE *file) { diff --git a/src/test.c b/src/test.c index 1e9bd67..52b7a0f 100644 --- a/src/test.c +++ b/src/test.c @@ -2,6 +2,7 @@ #include #include +#include static void print_tga_data(TGAImage *img) { @@ -59,17 +60,18 @@ int main(int argc, char **argv) TGAImage *img = new_tga_image(TGA_TRUECOLOR, 32, 128, 255); if(!img) { + printf("An error occurred: %s\n", tga_error_str()); return tga_error(); } for(int x = 0; x < tga_get_width(img); x++) { - for(int y = 0; y < tga_get_height(img); y++) - { - tga_set_alpha_at(img, x, y, 255); - tga_set_red_at(img, x, y, y); - tga_set_green_at(img, x, y, y); - tga_set_blue_at(img, x, y, y); - } + for(int y = 0; y < tga_get_height(img); y++) + { + tga_set_alpha_at(img, x, y, 255); + tga_set_red_at(img, x, y, (y * x) % 255); + tga_set_green_at(img, x, y, y); + tga_set_blue_at(img, x, y, x); + } } char *file_path = argc == 2 ? argv[1] : default_file;