diff options
author | kdx <kikoodx@paranoici.org> | 2022-09-12 12:57:22 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2022-09-12 12:57:22 +0200 |
commit | e4745b1d61157469893646e3893d80f57328ab59 (patch) | |
tree | 433f70ff9c7f68deaddc4bb01528ecbe16a1a7e4 | |
parent | 91ddea20e60895f57417dcac1b523be2292c5c19 (diff) | |
download | lzr-e4745b1d61157469893646e3893d80f57328ab59.tar.gz |
integrate sdl image
-rw-r--r-- | Tupfile | 2 | ||||
-rw-r--r-- | lzr.c | 7 |
2 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,5 @@ CFLAGS = -Wall -Wextra -std=c99 -pedantic `sdl2-config --cflags` -LDFLAGS = -ldx `sdl2-config --libs` -lSDL2_gfx +LDFLAGS = -ldx `sdl2-config --libs` -lSDL2_gfx -lSDL2_image .gitignore : foreach *.c |> gcc $(CFLAGS) -c -o %o %f |> %B.o @@ -2,6 +2,7 @@ #include "lzr.h" #include <SDL2/SDL.h> #include <SDL2/SDL2_gfxPrimitives.h> +#include <SDL2/SDL_image.h> #include <dx/log.h> #include <dx/mem.h> #include <dx/str.h> @@ -156,6 +157,10 @@ int LZR_Init(LZR_Config cfg) dx_log_error("%s", SDL_GetError()); return -1; } + if (IMG_Init(IMG_INIT_PNG) != IMG_INIT_PNG) { + dx_log_error("%s", IMG_GetError()); + return -1; + } basepath = SDL_GetBasePath(); if (basepath == NULL) { dx_log_error("%s", SDL_GetError()); @@ -245,7 +250,7 @@ int LZR_ImageLoad(const char *path) dx_log_error("_path_prefix failed"); return -1; } - SDL_Surface *const bmp = SDL_LoadBMP(apath); + SDL_Surface *const bmp = IMG_Load(apath); dx_free(apath); if (bmp == NULL) { dx_log_error("%s: %s", path, SDL_GetError()); |