aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2022-09-12 12:57:22 +0200
committerkdx <kikoodx@paranoici.org>2022-09-12 12:57:22 +0200
commite4745b1d61157469893646e3893d80f57328ab59 (patch)
tree433f70ff9c7f68deaddc4bb01528ecbe16a1a7e4
parent91ddea20e60895f57417dcac1b523be2292c5c19 (diff)
downloadlzr-e4745b1d61157469893646e3893d80f57328ab59.tar.gz
integrate sdl image
-rw-r--r--Tupfile2
-rw-r--r--lzr.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/Tupfile b/Tupfile
index 85b5b82..0d2d81c 100644
--- a/Tupfile
+++ b/Tupfile
@@ -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
diff --git a/lzr.c b/lzr.c
index 2789751..7a88adf 100644
--- a/lzr.c
+++ b/lzr.c
@@ -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());